Skip to content

Read and Delivery Receipts #182

@PS2009DT

Description

@PS2009DT

Hi,

It is me again!

Would you be able to add in functionality to add delivery and read notifications. Currently i have modified your code as below but happy for you to devise another approach too.

Using SMTP headers, I check if read or delivery is needed and I set it

internal static Message CreateGraphMessageFromFluentEmail(IFluentEmail email)
{
    var itemBody = new ItemBody
    {
        Content = email.Data.Body,
        ContentType = email.Data.IsHtml ? BodyType.Html : BodyType.Text,
    };

    var message = new Message
    {
        Subject = email.Data.Subject,
        Body = itemBody,
        From = ConvertToRecipient(email.Data.FromAddress),
        ReplyTo = CreateRecipientList(email.Data.ReplyToAddresses),
        ToRecipients = CreateRecipientList(email.Data.ToAddresses),
        CcRecipients = CreateRecipientList(email.Data.CcAddresses),
        BccRecipients = CreateRecipientList(email.Data.BccAddresses),
    };

    SetPriority(email, message);

    //Check if read receipt is needed

    if(email.Data.Headers.ContainsKey("Return-Receipt-To"))
    {
        email.Data.Headers.Remove("Return-Receipt-To");
        email.Data.Headers.Remove("Disposition-Notification-To");
        message.IsDeliveryReceiptRequested = true;
        message.IsReadReceiptRequested = true;
    }

    SetHeaders(email, message);

    return message;
}

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions