+1 vote

I am testing the component to handle email Bounces when emails are downloaded using IMAP. I have used your sample code to pick up 11 bounced emails from the inbox folder and only 3 are recognised as bounces. The 3 it does recognise have null properties for all properties such as reason, action and status.

I think this is because the bounce reason for email I am testing is held in an attachment txt file from Microsoft 365.

foreach (long uid in client.Search(Flag.Unseen))
{
    IMail email = new MailBuilder().CreateFromEml(
        client.GetHeadersByUID(uid));

    Bounce bounce = new Bounce();
    BounceResult result = bounce.Examine(email);

    if (result.IsDeliveryFailure)
    {
        Console.WriteLine("Reason {0}: Action {1}: Status {2}", 
            result.Reason, result.Action, result.Status));
    }
}

Can you confirm how you do or do not support this kind of failure?

by
reshown by

1 Answer

0 votes
 
Best answer

Mail.dll correctly recognizes bounces from Outlook.com and Office 365, our unit tests cover that.

Your problem is elsewhere: Don't use Imap.GetHeadersByUID, as this method downloads headers only.

You should be using Imap.GetMessageByUID method.

by (301k points)
selected by
Bounced email fetching not working
...