[system.net.mail.smtpclient]: Does anyone know of a *real* way to validate a successful email send?

I've looked in the intellisense, online .Net docs, and on here...
long story short i can send email but want to read the status code of those emails... preferably the SMTP status code.

so far the only close solution to verifying a successful send is using the mailmsg.deliverynotificationoptions.. but that's hardly a solution... that is based on a return email for delivery notification...

for catching errors it's easy enough... just try/catch it and grab the status code there... but i'm looking for something on the success/delay (delays can still be successful) status code as well.

I'm looking for a status code (250 OK, 500 ERR, etc), not some return email - a *real* way.

any help would be appreciated,
-Scott



Answer this question

[system.net.mail.smtpclient]: Does anyone know of a *real* way to validate a successful email send?

  • Jedrzej

    i'm storing records for historical logs... I'd *ideally* like some sort of return-success struct containing status code and timestamp (since it may or may not be sync/async)... who knows if the SMTP server's queue is busy or not ... who knows if a delayed send goes through or not (ok so in this case it'd need some identifier and some way to later connect and query on the ID for status, but anyway). the point is to have accurate logs, not "logs that assume 500 if it's blank here" (ok so that's a little derogatory, to which i am sorry, but the point remains).

    any ideas

    Thanks for your time,
    -Scott


  • Ralf_from_Europe

    What about using the logging

    http://www.systemnetmail.com/faq/4.10.aspx

    Would this suffice

    If not, you could use an SMTP server that you have admin rights to, and use the message tracking abilities on that server to validate the success/failure. You could even parse through log files programatically to validate each message went through. Seems like a lot of work, though. SMTP is pretty darn reliable. I don't know your business driver -- if you must have guaranteed delivery for legal reasons, or whatever -- but I think for most folks, SMTP is reliable enough.



  • sqlguy12

    Assuming appropriate & unique 'subject' content of a mail, so when a mail is undelivered, then we get a return mail prefixed to 'subject' of a mail with "Undeliverable". Could be possible to relate the mail with status as failure.

    But how to continuously poll the mail server just for failure return mails Performance as well as development wise how this approach would be

    If anybody has this solution, then sample code would be of great help.

    Thanks & Regards

    Rizwan


  • FlashyPants

    SMTP is store and forward. Means that that if the smtp server accepts there is no guarantee that it gets really delivered. So your way of finding out what happened is not quite accurate.


  • XBTester

    What is the real scenario
    You can count that the mail delivery is successful if the
    send is successful. The Class is supposed to abstact out all the
    details of the SMTP protocol so we don't expose the underlying status codes. In short it is successful if the send does not thrown an exception

  • [system.net.mail.smtpclient]: Does anyone know of a *real* way to validate a successful email send?