4

I want to be able to tell if an email sent to a user is successful or not.

I've tried looking at the SMTP logs and there appears to be no way to link server requests with server responses. So if I get an error 550 and the attempted address is not included in the response, I have no way of knowing what address or what request it failed for.

Looking for a solution either in the logs or the code that sends.

3
  • @Mods, there's no reason to close this, its a legitimate question. IIS acts as an intermediate that accepts pretty much anything. The question is how to get more information from IIS or bypass it completely.
    – Chris Haas
    Jan 26, 2011 at 17:16
  • Should your question be How do i tell if an email was successfully sent? There is no way to tell if one was successfully received by the end user, if there was it would be a gold mine for spammers.
    – slugster
    Jan 27, 2011 at 0:30
  • I want to know which email address a SMTP server returns an error for so I can take further action like stop sending those emails.
    – Micah B.
    Jan 27, 2011 at 22:44

2 Answers 2

7

Some background:
A properly configured server should tell you imediately if the mail will not be delivered.

iirc: Originally SMTP servers did this, but then it was considered a security hole to reveal if an user exists on the system or not so they started accepting all and then bouncing. But bouncing is used by spammers to deliver spam by "bouncing it back to the spam target". So now we are back at declining the email immediately based on relay rules.

This means that in most cases you can determine if the email was delivered or not. But only if you communicate directly with the receivers email server. This means that your application needs to do a lot of work: MX-lookup, TCP connect to a potential slow server which could use tarpit so its damn slow, handle timeout, etc. The problem is that you will not handle servers that are temporarily down very well.

If you send the email by delivering it to a relay server (like your local IIS SMTP server or your ISP) then the only way to detect bounces is by setting bounce header in the mail and checking the bounce account for bounced mails. This is not an uncommon aproach. It can however take up to (and over) 5 days for all bounces to come back depending on retry settings on the SMTP-servers down the chain.

This problem is often solved by simply adding url to an image inside the message. When the user clicks "download content" the image is downloaded and you can confirm receive. The image could be http://server.com/[email protected] or it could be an aspx-page you make that uses Response.SendFile to send an image (you may want to set Content-Type in Response.Header too).

2
  • Good info. The image technique isn't as useful to me, because I don't think I care if they read it, but just that it was delivered. So if I wanted to create a deliverability report, I guess I would have to do that based on the NDR emails I get back. Yuck.
    – Micah Burnett
    Jan 26, 2011 at 17:56
  • Ahh, I didn't think about the BadMail directory. I'm going to parse through the *.BAD files to create a report on each email. This is perfect. Thanks for putting me on the right path.
    – Micah B.
    Jan 28, 2011 at 10:39
1

The only way that I know of is to bypass IIS's SMTP server and send it directly. You can google around and find some components that will do it for you, otherewise here's a link for a raw TCP version:

This of course doesn't mean that the message was received/delivered or that it didn't bounce. It just means the SMTP listed in the MX records accepted the message. It might have trashed it, it might bounce it later, it might pass it on to the user.

1
  • Thanks for the info. I don't have the time to write my own SMTP server with retries and everything else. It seems a shame to have to use a different SMTP server just to track a session id. Changing SMTP servers may be further than I want to go, I don't know of other servers that would be reliable.
    – Micah Burnett
    Jan 26, 2011 at 18:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .