For many email campaign applications, the very important task is detecting if the email is received by recipient or not. Parsing the delivery report is the common way to get the email status. It is strongly recommend that you remove the invalid or non-existent recipient from your mail listing to save networking resource.
SMTP Transport Error and Failure Report (NDS)
When you are sending an email to a recipient by EASendMail:
If you call SendMail method and this method throws an exception, this is a SMTP Transport Error and you will not get Failure Report (NDS). In this case, you can get the error detail from the Exeception object.
If you call SendMail method successfully, that means the email has been submitted to the SMTP server. The SMTP server will deliver the email in background, if the email couldn't be delivered, a Failure Report (NDS) will be sent back to your sender email address.
To retrieve and parse Failure Report (NDS), you should monitor your sender mailbox. We recommend that you use EAGetMail Component to monitor your sender mailbox by POP3/IMAP4/Exchange WebDAV/Exchange Web Service protocol. After you installed EAGetMail on your machine, there are several full samples named "parse_report.*" for VB.NET, C# in the installation path.
Parse Non-Delivery Report (NDS) in C#
Parse Non-Delivery Report (NDS) in VB
If there is no Failure Report arrived in 24 hours, that means the email has arrived to user mailbox.
SMTP Transport Error and Failure Report are supported by all SMTP servers, so we strongly recommend that you catch SMTP Transport Error and parse Failure Report (NDS).
Delivery Receipt
It is also called a DSN (delivery service notification), which is a request to the recipient’s email server to send you a notification about the delivery of an email you've just sent. The notification takes the form of an email, and will tell you if your delivery succeeded (Delivery Receipt), failed, got delayed (Failure Report (NDS)).
Import Notice: Not every SMTP server support Delivery Receipt. Only the SMTP server that supports DSN extension command accepts Delivery Receipient request, otherwise you will get error when you are sending email.
The following example codes demonstrate how to request read receipt and delivery receipt:
[C#] // The following example codes demonstrate requesting read receipt and delivery receipt // To get full sample projects, please download and install EASendMail on your machine. // To run it correctly, please change SMTP server, user, password, sender, recipient value to yours using System; using System.Text; using EASendMail; void SendMail() { try { SmtpMail oMail = new SmtpMail("TryIt"); // Set sender email address, please change it to yours oMail.From = "test@emailarchitect.net"; // Set recipient email address, please change it to yours oMail.To = "support@emailarchitect.net"; // Set email subject oMail.Subject = "test email from c# project"; // Set email body oMail.TextBody = "this is a test email sent from c# project, do not reply"; // Request read receipt oMail.ReadReceipt = true; // Request both failure and success report oMail.DeliveryNotification = DeliveryNotificationOptions.OnFailure | DeliveryNotificationOptions.OnSuccess; // Your SMTP server address SmtpServer oServer = new SmtpServer("smtp.emailarchitect.net"); // User and password for ESMTP authentication oServer.User = "test@emailarchitect.net"; oServer.Password = "testpassword"; // Most mordern SMTP servers require SSL/TLS connection now. // ConnectTryTLS means if server supports SSL/TLS, SSL/TLS will be used automatically. oServer.ConnectType = SmtpConnectType.ConnectTryTLS; SmtpClient oSmtp = new SmtpClient(); oSmtp.SendMail(oServer, oMail); Console.WriteLine("email was sent successfully!"); } catch (Exception ep) { Console.WriteLine("failed to send email {0}", ep.Message); } }
[VB] ' The following example codes demonstrate requesting read receipt and delivery receipt ' To get full sample projects, please download and install EASendMail on your machine. ' To run it correctly, please change SMTP server, user, password, sender, recipient value to yours Imports EASendMail Sub SendMail() Try Dim oMail As New SmtpMail("TryIt") ' Set sender email address, please change it to yours oMail.From = "test@emailarchitect.net" ' Set recipient email address, please change it to yours oMail.To = "support@emailarchitect.net" ' Set email subject oMail.Subject = "test email from VB.NET project" ' Set email body oMail.TextBody = "this is a test email sent from VB.NET project, do not reply" ' Your SMTP server address Dim oServer As New SmtpServer("smtp.emailarchitect.net") ' User and password for ESMTP authentication oServer.User = "test@emailarchitect.net" oServer.Password = "testpassword" ' Most mordern SMTP servers require SSL/TLS connection now. ' ConnectTryTLS means if server supports SSL/TLS, SSL/TLS will be used automatically. oServer.ConnectType = SmtpConnectType.ConnectTryTLS ' Request read receipt oMail.ReadReceipt = True ' Request both failure and success report oMail.DeliveryNotification = DeliveryNotificationOptions.OnFailure Or DeliveryNotificationOptions.OnSuccess Dim oSmtp As New SmtpClient() oSmtp.SendMail(oServer, oMail) Console.WriteLine("email was sent successfully!") Catch ep As Exception Console.WriteLine("failed to send email {0}", ep.Message) End Try End Sub
Email Tracking
Email tracking is used to verify that emails are actually read by recipients. There are two common solutions:
Read Receipt
Some e-mail applications, such as Microsoft Office Outlook, employ a read-receipt tracking mechanism. A sender selects the receipt request option prior to sending the message. Upon opening the email, each recipient has the option of notifying the sender that the message was opened and read.
However, there is no guarantee that you will get a read-receipt. Some possible reason are that very few e-mail applications or services support read receipts, or simply because users disable the functionality. Those do support read-receipt aren't necessarily compatible with or capable of recognizing requests from a different e-mail service or application.
How to parse read receipt:
Parse Delivery Receipt and Read-Receipt in C#
Parse Delivery Receipt and Read-Receipt in VB
Linked Image Tracking
Some email marketing tools include tracking as a feature. Such email tracking is usually accomplished using standard web tracking devices known as cookies and web beacons. When you send a tracked email message, if it is a graphical HTML message (not a plain text message) the email marketing system may embed a tiny, invisible tracking image (a single-pixel gif, sometimes called a web beacon) within the content of the message. When the recipient opens the message, the tracking image is referenced.
For example: In your HTML body, you link a image to your website like this: <img src="http://yoursite/trace.aspx?id=12323" />. When the user opens the email, http://yoursite/trace.aspx?id=12323 will be accessed by user email client. Your trace.aspx can record the id to database to identify the email to this user has been read and return a small image.
To prevent email marketers, spammers and phishers use tracking maliciously, almost 100% email client don't open the linked image directly. The email client ususally asks the user if it should display the linked image, if the user answer "no", the tracking image will not be openned. That means you can only trace the email under user permission, it is a good protection for user privacy.
Linked Image Tracking can sometimes reveal if emails get forwarded (but not usually to whom). When used maliciously, it can be used to collect confidential information about businesses and individuals and to create more effective phishing schemes.
If you are using email tracking, your company's privacy policy should state that you may use tracking devices such as cookies and web beacons.
Test Email Address
Validate Email Address Syntax and Test Email Address in VB
Validate Email Address Syntax and Test Email Address in C#
Firstly, SmtpClient performs a DNS MX record query. If it retrieves the recipient's local SMTP server successfully, SmtpClient will try to connect to this server. SmtpClient then performs "RCPT TO" command to test if this SMTP server accepts this email address.
Because it totally depends on your networking connection, if your networking connection to the recipient server is bad or your IP address is blocked by the recipient server, test will be failed, but it doesn't mean this email address is invalid.
Moreover, to prevent email address testing, many email providers accept the recipient address at first no matter if the address is valid or invalid, only after you sent the email data to the server, then the server rejects it if the recipient address is invalid.
Send the email to the recipient without testing. If you don't get Transport Error and Failure Report in 24 hours, that means the recipient is valid. If you get Failure Report, you should consider to remove this recipient from your mail listing.
See Also
Using EASendMail SMTP .NET Component
User Authentication and SSL Connection
Enable TLS 1.2 on Windows XP/2003/2008/7/2008 R2
Using Gmail SMTP OAUTH
Using Gmail/GSuite Service Account + SMTP OAUTH Authentication
Using Office365 EWS OAUTH
Using Office365 EWS OAUTH in Background Service
Using Hotmail SMTP OAUTH
From, ReplyTo, Sender and Return-Path
Digital Signature and E-mail Encryption
DomainKeys and DKIM Signature
Send E-mail Directly (Simulating SMTP server)
Work with EASendMail Service (Email Queuing)
Bulk Email Sender Guidelines
EASendMail .NET Namespace References
EASendMail SMTP Component Samples