0 votes

Using ReceiptBuilder I dont see any way to create an MDN Failed.

How would I do this manually?

by

1 Answer

0 votes
 
Best answer

Are you sure you are not confusing MDNs (Message Disposition Notifications) with DSNs (Delivery Status Notifications)?

  • DSNs are used to return indications of message delivery to the sender of that message.

  • MDNs (read receipts) provide a notification of the "disposition" of a message - indicating whether it is read by a recipient or discarded before being read.

ReadReceiptBuilder class is for creating MDNs (read receipts) only.

To create a failed read receipt use the code below. Most likely you'll get original email from an IMAP server. Here we build it by-hand:

MailBuilder builder = new MailBuilder();
builder.From.Add(new MailBox("alice@example.com"));
builder.To.Add(new MailBox("bob@example.com"));
IMail original = builder.Create();
// original: alice@example.com -> bob@example.com

ReadReceiptBuilder rrBuilder = new ReadReceiptBuilder(
    original, 
    notificationRecipients:new List<MailBox>
        {
            new MailBox("alice@example.com") 
        }
    );

IMail readReceipt = rrBuilder.Was(
    from: new MailBox("bob@example.com"), 
    disposition: DispositonType.Failed,
    manual: true)
    .Create();
// Read receipt: bob@example.com -> alice@example.com
by (301k points)
selected by
...