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 return an error, 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 VB6
Parse Non-Delivery Report (NDS) in DELPHI
Parse Non-Delivery Report (NDS) in VC++
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:
[VB6, VBA] ' 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 Const ConnectNormal = 0 Const ConnectSSLAuto = 1 Const ConnectSTARTTLS = 2 Const ConnectDirectSSL = 3 Const ConnectTryTLS = 4 Const Notification_None = 0 Const Notification_OnSuccess = 2 Const Notification_OnFailure = 4 Const Notification_Delay = 8 Const Notification_Never = 16 Private Sub btnSendMail_Click() Dim oSmtp As New EASendMailObjLib.Mail oSmtp.LicenseCode = "TryIt" ' Your SMTP server address oSmtp.ServerAddr = "smtp.emailarchitect.net" ' User and password for ESMTP authentication oSmtp.UserName = "test@emailarchitect.net" oSmtp.Password = "testpassword" ' If server supports SSL/TLS connection, SSL/TLS is used automatically. oSmtp.ConnectType = ConnectTryTLS ' Set your sender email address oSmtp.FromAddr = "test@emailarchitect.net" ' Add recipient email address oSmtp.AddRecipientEx "support@emailarchitect.net", 0 ' Set email subject oSmtp.Subject = "simple email from VB 6.0 project" ' Set email body oSmtp.BodyText = "this is a test email sent from VB 6.0 project, do not reply" ' Request read receipt oSmtp.ReadReceipt = True ' Request both failure and success report oSmtp.DeliveryNotification = Notification_OnFailure Or _ Notification_OnSuccess MsgBox "start to send email ..." If oSmtp.SendMail() = 0 Then MsgBox "email was sent successfully!" Else MsgBox "failed to send email with the following error:" & oSmtp.GetLastErrDescription() End If End Sub
[Delphi] // 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 Unit Unit1; Interface Uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, EASendMailObjLib_TLB; // add EASendMail Unit Type TForm1 = Class(TForm) Button1: TButton; Procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } End; Const ConnectNormal = 0; ConnectSSLAuto = 1; ConnectSTARTTLS = 2; ConnectDirectSSL = 3; ConnectTryTLS = 4; Notification_None = 0; Notification_OnSuccess = 2; Notification_OnFailure = 4; Notification_Delay = 8; Notification_Never = 16; Var Form1: TForm1; Implementation {$R *.dfm} Procedure TForm1.Button1Click(Sender: TObject); Var oSmtp : TMail; Begin oSmtp := TMail.Create(Application); oSmtp.LicenseCode := 'TryIt'; // Your SMTP server address oSmtp.ServerAddr := 'smtp.emailarchitect.net'; // User and password for ESMTP authentication oSmtp.UserName := 'test@emailarchitect.net'; oSmtp.Password := 'testpassword'; // If server supports SSL/TLS connection, SSL/TLS is used automatically. oSmtp.ConnectType := ConnectTryTLS; // Set your sender email address oSmtp.FromAddr := 'test@emailarchitect.net'; // Add recipient email address oSmtp.AddRecipientEx('support@emailarchitect.net', 0); // Set email subject oSmtp.Subject := 'simple email from Delphi project'; // Set email body oSmtp.BodyText := 'this is a test email sent from Delphi project, do not reply'; // Request read receipt oSmtp.ReadReceipt := True; // Request both failure and success report oSmtp.DeliveryNotification := Notification_OnFailure Or Notification_OnSuccess; ShowMessage('start to send email ...'); If oSmtp.SendMail() = 0 Then ShowMessage('email was sent successfully!') Else ShowMessage('failed to send email with the following error: ' + oSmtp.GetLastErrDescription()); End; End.
[VC++] // 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 #include "stdafx.h" #include <tchar.h> #include <Windows.h> #include "EASendMailObj.tlh" using namespace EASendMailObjLib; const int ConnectNormal = 0; const int ConnectSSLAuto = 1; const int ConnectSTARTTLS = 2; const int ConnectDirectSSL = 3; const int ConnectTryTLS = 4; const int Notification_None = 0; const int Notification_OnSuccess = 2; const int Notification_OnFailure = 4; const int Notification_Delay = 8; const int Notification_Never = 16; int _tmain(int argc, _TCHAR* argv[]) { ::CoInitialize(NULL); IMailPtr oSmtp = NULL; oSmtp.CreateInstance("EASendMailObj.Mail"); oSmtp->LicenseCode = _T("TryIt"); // Your SMTP server address oSmtp->ServerAddr = _T("smtp.emailarchitect.net"); // User and password for ESMTP authentication oSmtp->UserName = _T("test@emailarchitect.net"); oSmtp->Password = _T("testpassword"); // If server supports SSL/TLS connection, SSL/TLS is used automatically. oSmtp->ConnectType = ConnectTryTLS; // Set your sender email address oSmtp->FromAddr = _T("test@emailarchitect.net"); // Add recipient email address oSmtp->AddRecipientEx(_T("support@emailarchitect.net"), 0); // Set email subject oSmtp->Subject = _T("simple email from Visual C++ project"); // Set email body oSmtp->BodyText = _T("this is a test email sent from Visual C++ project, do not reply"); // Request read receipt oSmtp->ReadReceipt = VARIANT_TRUE; // Request both failure and success report oSmtp->DeliveryNotification = Notification_OnFailure | Notification_OnSuccess; _tprintf(_T("Start to send email ...\r\n")); if(oSmtp->SendMail() == 0) { _tprintf(_T("email was sent successfully!\r\n")); } else { _tprintf(_T("failed to send email with the following error: %s\r\n"), (const TCHAR*)oSmtp->GetLastErrDescription()); } return 0; }
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 VB6
Parse Delivery Receipt and Read-Receipt in DELPHI
Parse Delivery Receipt and Read-Receipt in VC++
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 VB6
Validate Email Address Syntax and Test Email Address in VC++
Validate Email Address Syntax and Test Email Address in Delphi
Firstly, Mail object performs a DNS MX record query. If it retrieves the recipient's local SMTP server successfully, Mail object will try to connect to this server. Mail object 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 ActiveX Object
Registration-free COM with Manifest File
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 Email Encryption - S/MIME
DomainKeys Signature and DKIM Signature
Send Email without SMTP server(DNS lookup)
Work with EASendMail Service(Mail Queuing)
Programming with Asynchronous Mode
Programming with FastSender
Mail vs. FastSender
Bulk Email Sender Guidelines
Process Bounced Email (Non-Delivery Report) and Email Tracking
Work with RTF and Word
EASendMail ActiveX Object References
EASendMail SMTP Component Samples