System.Net.Mail FAQ

Complete FAQ Listing


3.3.3 How do I request a read receipt? Printer Friendly

To request a read receipt, we need to specify a Disposition-Notification-To header. This header is recognized my most major mail clients to send a read receipt when the email is first read. It's important to note that just because you request a read receipt, doesn't' mean you will get one.

Read receipt requests may not be always honored because

1) A mail client may not recognize the special Disposition-Notification-To header.
2) A mail client may not implement that functionality.
3) The end user may have that functionality turned off.
4) The end user may optionally not choose to send one for your particular email.

[ C# ]

static void ReadReceipts()
{
//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("me@mycompany.com");
mail.To.Add("you@yourcompany.com");

//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";

//To request a read receipt, we need add a custom header named 'Disposition-Notification-To'
//in this example, read receipts will go back to 'someaddress@mydomain.com'
//it's important to note that read receipts will only be sent by those mail clients that 
//a) support them
//and
//b)have them enabled.
mail.Headers.Add("Disposition-Notification-To", "<someaddress@mydomain.com>");


//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
}



[ VB.NET ]
Sub ReadReceipts()
'create the mail message
Dim mail As New MailMessage()

'set the addresses
mail.From = New MailAddress("me@mycompany.com")
mail.To.Add("you@yourcompany.com")

'set the content
mail.Subject = "This is an email"
mail.Body = "this is the body content of the email."

'To request a read receipt, we need add a custom header named 'Disposition-Notification-To'
'in this example, read receipts will go back to 'someaddress@mydomain.com'
'it's important to note that read receipts will only be sent by those mail clients that 
'a) support them
'and
'b)have them enabled.
mail.Headers.Add("Disposition-Notification-To", "<someaddress@mydomain.com>")


'send the message
Dim smtp As New SmtpClient("127.0.0.1")
smtp.Send(mail)
End Sub 'ReadReceipts