How to confirm that mail has been delivered or not?

Sankar M picture Sankar M · Aug 17, 2011 · Viewed 46.5k times · Source

Below is my coding, just have a look at it

System.Net.Mail.MailMessage oMail = new System.Net.Mail.MailMessage();
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
oMail.From = new System.Net.Mail.MailAddress("[email protected]");
oMail.To.Add(TextBox1.Text.Trim());
oMail.Subject = "Subject*";
oMail.Body = "Body*";
oMail.IsBodyHtml = true;
smtp.Host = "smtp.sendgrid.net";
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("myusername", "mypassword");
smtp.UseDefaultCredentials = false;
smtp.Credentials = cred;
smtp.Send(oMail);

Here I need to check whether that mail has been delivered or not.

Answer

Andrey Agibalov picture Andrey Agibalov · Aug 17, 2011

You can't. Since you use SMTP, in general case, it's impossible to tell whether delivery succeeded or not. Read SMTP specification. Mail is routed while being delivered, so:

  1. There's no guarantee your message is sent as soon as you call smtp.Send().
  2. Since SMTP is routed, you can't be sure that some node on the route won't fail with delivery to uplink.