Problems sending email using .Net's SmtpClient

Posted by Jason Haley on Server Fault See other posts from Server Fault or by Jason Haley
Published on 2012-06-22T00:19:02Z Indexed on 2012/06/22 3:18 UTC
Read the original article Hit count: 474

Filed under:
|
|

I've been looking through questions on Stackoverflow and Serverfault but haven't found the same problem mentioned - though that may be because I just don't know enough about how email works to understand that some of the questions are really the same as mine ... here's my situation:

I have a web application that uses .Net's SmtpClient to send email. The configuration of the SmtpClient uses a smtp server, username and password. The SmtpClient code executes on a server that has an ip address not in the domain the smtp server is in.

In most cases the emails go without a problem - but not AOL (and maybe others - but that is one we know for sure right now).

When I look at the headers in the message that was kicked back from AOL it has one less line than the successful messages hotmail gets:

AOL Bad Message:

Received: from WEBSVRNAME ([##.###.###.###]) by domainofsmtp.com with MailEnable ESMTP; Mon, 18 Jun 2012 09:48:24 -0500
MIME-Version: 1.0
From: "[email protected]" <[email protected]>
...

Good Hotmail Message:

Received: from mail.domainofsmtp.com ([###.###.###.###]) by subdomainsof.hotmail.com with Microsoft SMTPSVC(6.0.3790.4900); Thu, 21 Jun 2012 09:29:13 -0700
Received: from WEBSVRNAME ([##.###.###.###]) by domainofsmtp.com with MailEnable ESMTP; Thu, 21 Jun 2012 11:29:03 -0500
MIME-Version: 1.0
From: "[email protected]" <[email protected]>
...

Notice the hotmail message headers has an additional line.

I'm confused as to why the Web server's name and ip address are even in the headers since I thought I was using the SmtpClient to go through the smtp server (hence the need for the username and password of a valid email box).

I've read about SPFs, DKIM and SenderID's but at this point I'm not sure if I would need to do something with the web server (and its ip/domain) or the domain the smtp is coming from. Has anyone had to do anything similiar before?

Am I using the smtp server as a relay? Any help on how to describe what I'm doing would also help.

© Server Fault or respective owner

Related posts about email

Related posts about smtp