Skip to content

rgl/MailBounceDetector

Repository files navigation

MailBounceDetector

Build status

this library detects whether a message is a bounce message.

this detects standard and qmail bounce messages.

see the unit tests for an example on how that information is exposed by the library.

Standard bounce messages

a bounce message is one that has (or is) a multipart/report; report-type=delivery-status MIME part. its comprised of two or three sub-parts:

  1. the human readable description of the bounce. normally this is a text/plain or text/html part.
  2. the machine readable description of the bounce. this is a message/delivery-status part.
  3. the original message that bounced. this part is optional, and might not have the complete message. its useful to known some of the original message headers such as the Message-Id. this is normally a message/rfc822 part.

the most important part is the message/delivery-status part; it looks something like:

Content-Type: message/delivery-status

Reporting-MTA: dns; PTPEDGE02.test.local

Final-recipient: RFC822;
    [email protected]
Action: failed
Status: 5.1.1
Remote-MTA: dns; mx.google.com
X-Supplementary-Info: <mx.google.com #5.1.1 smtp;550-5.1.1 The email account
    that you tried to reach does not exist.Please try 550-5.1.1 double-checking
the recipient's email address for typos or 550-5.1.1 unnecessary spaces.
    Learn more at 550 5.1.1  https://support.google.com/mail/answer/6596
    om11si19081667wic.29 - gsmtp>

Standard bounce messages references

qmail bounce messages

a bounce message is one that is a text/plain (which can also be inside a multipart/alternative) MIME part, e.g.:

Date: 17 Mar 1996 03:54:40 -0000
From: [email protected]
To: [email protected]
Subject: failure notice

Hi. This is the qmail-send program at silverton.berkeley.edu.
I'm afraid I wasn't able to deliver your message to the
following addresses. This is a permanent error; I've given up.
Sorry it didn't work out.

<[email protected]>:
Sorry, I couldn't find any host by that name.

--- Below this line is a copy of the message.

Return-Path: <[email protected]>
Received: (qmail 317 invoked by uid 7); 17 Mar 1996 03:54:38 -0000
Date: 17 Mar 1996 03:54:38 -0000
Message-ID: <[email protected]>
From: [email protected] (D. J. Bernstein)
To: [email protected]
Subject: are you there?

Just checking.

qmail bounce messages references

About

Detects whether a MailKit email Message is a bounce message

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published