{"id":1932,"date":"2011-08-19T13:06:03","date_gmt":"2011-08-19T11:06:03","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=1932"},"modified":"2016-12-05T13:52:00","modified_gmt":"2016-12-05T11:52:00","slug":"bounce-handling","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/bounce-handling","title":{"rendered":"Bounce handling"},"content":{"rendered":"<p>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 <strong>delivery problem<\/strong>. The original message is said to have bounced.<\/p>\n<p>Errors may occur at multiple places during email delivery. A sender may sometimes receive a <strong>bounce message from a recipient&#8217;s mail server<\/strong>. Bounce messages from the recipient&#8217;s mail server are required when a mail server accepted a message that was undeliverable.<\/p>\n<p>You can use Mail.dll <a href=\"\/mail\">.NET email component<\/a> to analyze the email message and determine if it is a bounce.<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nIMail email = ...;\r\n\r\nBounce bounce = new Bounce();\r\nList&lt;BounceResult&gt; results = bounce.ExamineAll(email);\r\n\r\nbool isDeliveryFailure = results.Count &gt; 0;\r\n\r\nforeach(var result in results)\r\n{\r\n    Console.WriteLine(result.Recipient);\r\n\r\n    Console.WriteLine(result.Action);    \/\/ DSNAction.Failed or DSNAction.Delayed\r\n\r\n    Console.WriteLine(result.Reason);\r\n    Console.WriteLine(result.Status);\r\n}\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nDim email As IMail = ...\r\n\r\nDim bounce As New Bounce()\r\nDim results As List(Of BounceResult) = bounce.ExamineAll(email)\r\n\r\nDim isDeliveryFailure As Boolean = results.Count &gt; 0\r\n\r\nFor Each result As var In results\r\n\tConsole.WriteLine(result.Recipient)\r\n\r\n\tConsole.WriteLine(result.Action)\t' DSNAction.Failed or DSNAction.Delayed\r\n\r\n\tConsole.WriteLine(result.Reason)\r\n\tConsole.WriteLine(result.Status)\r\nNext\r\n\r\n<\/pre>\n<p>Mail.dll processes Multipart\/Report mime parts (defined in <a href=\"\/mail\/rfc\/6522\">RFC 6522<\/a>) to recognize bounce messages, as well as other heuristics (X-Failed-Recipients header, subject and body scanning).<\/p>\n<p>Unfortunately, most bounce messages have historically been designed to be read by users, not automatically handled by software. It&#8217;s nearly impossible to reliably interpret the meaning of every single bounce message. <em>Bounce<\/em> class handles large proportion of bounces, but it will never be 100% reliable. <\/p>\n<p>You may also consider using other techniques to recognize bounces such as <a href=\"\/blog\/verp-variable-envelope-return-path-net\">Variable Envelope Return Path (VERP)<\/a> method.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[15,33,57],"class_list":["post-1932","post","type-post","status-publish","format-standard","hentry","category-mail-dll","tag-c","tag-email-component","tag-vb-net"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1932"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=1932"}],"version-history":[{"count":9,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1932\/revisions"}],"predecessor-version":[{"id":5163,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1932\/revisions\/5163"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=1932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=1932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=1932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}