Bounce handling

Bounce message, also called a (failed) Delivery Status Notification (DSN) is an automated electronic email message from a mail system informing the sender about a delivery problem. The original message is said to have bounced.

Errors may occur at multiple places during email delivery. A sender may sometimes receive a bounce message from a recipient’s mail server. Bounce messages from the recipient’s mail server are required when a mail server accepted a message that was undeliverable.

You can use Mail.dll .NET email component to analyze the email message and determine if it is a bounce.

// C#

IMail email = ...;

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

if (result.IsDeliveryFailure)

    Console.WriteLine(result.Action);    // DSNAction.Failed or DSNAction.Delayed


Dim email As IMail = ...

Dim bounce As New Bounce()
Dim result As BounceResult = bounce.Examine(email)

If result.IsDeliveryFailure Then

	Console.WriteLine(result.Action)	' DSNAction.Failed or DSNAction.Delayed

End If

Mail.dll processes Multipart/Report mime parts (defined in RFC 6522) to recognize bounce messages, as well as other heuristics (X-Failed-Recipients header, subject and body scanning).

Unfortunately, most bounce messages have historically been designed to be read by users, not automatically handled by software. It’s nearly impossible to reliably interpret the meaning of every single bounce message. Bounce class handles large proportion of bounces, but it will never be 100% reliable.

You may also consider using other techniques to recognize bounces such as Variable Envelope Return Path (VERP) method.

Tags: , ,


Consider using our Q&A forum for asking any questions.