How to validate Read Receipt works or not?

0 votes

I have implemented the Read Receipt below.

IMail originalEMail = currentEmail.RequestReadReceipt().Create();
ReadReceiptBuilder readReceipt = new ReadReceiptBuilder(originalEMail);

MailBuilder builder = readReceipt.Was(
    new MailBox(emailDetails.TOAddresses), 

IMail readReceiptEmail = builder.Create();

and sending the mails like below.

smtp.UseBestLogin(currentUser.EMailAddress, currentUser.EMailPassword);

smtp.Configuration.DeliveryNotification = 
    | DeliveryNotificationOptions.OnFailure;

ISendMessageResult sendResult = smtp.SendMessage(originalEMail);

sendResult = smtp.SendMessage(readReceiptEmail);

We are getting original mail and receipt mail only we send the read receipt mail. IS it the correct way of implementation.

Please advice.

asked Mar 18 by facil (200 points)

1 Answer

0 votes

Your code doesn't look right.

To request read receipt you only need to use RequestReadReceipt method on MailBuilder when you create an email:

MailBuilder builder = new MailBuilder();
builder.From.Add(new MailBox("", "Alice"));
builder.To.Add(new MailBox("", "Bob"));
builder.Subject = "Please let me know if you like it";
builder.Html= "("<html>....</html>"";


IMail email = builder.Create();

Now you (Alice) should send this message (to Bob).

RequestReadReceipt adds certain headers to the message (Disposition-Notification-To, Return-Receipt-To and X-Confirm-Reading-To).

This way the recipient (Bob's email client) knows, that when message is read (by Bob), it should create a read receipt and send it back to the sender (Alice).

Please note that read receipt requests may not always work. Recipient mail client may not recognize those special headers; it may lack this feature at all or that functionality may be turned off.

Read receipt are also know as MDNs or Message Delivery Notifications.

When you (as Bob) receive a message, you need to check if it contains a read request - use IMail.GetReadReceiptAddresses:

IMail mail = ... // this is the email Alice sent to Bob

List<MailBox> addresses = mail.GetReadReceiptAddresses();
if (addresses.Count > 0)
    // Read receipt was requested (by Alice)

Now you know you want to create read receipt (as Bob) for particular email (received from Alice) - you should use ReadReceiptBuilder class for that:

IMail mail = ... // this is the email Alice sent to Bob

ReadReceiptBuilder mdnBuilder = new ReadReceiptBuilder(mail);
MailBuilder builder = mdnBuilder.WasDisplayed(new MailBox(""));
IMail mdn = builder.Create();

Now you (Bob) should send this read receipt back (to Bob).

answered Mar 19 by Limilabs support (183,500 points)
Thanks for the quick reply.