Process Bounced Email (Non-Delivery Report) and Email Tracking


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:

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:

Test Email Address

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