MailBounceDetector
Detects whether a MailKit email Message is a bounce message
Install / Use
/learn @rgl/MailBounceDetectorREADME
MailBounceDetector
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:
- the human readable description of the bounce. normally this is a
text/plainortext/htmlpart. - the machine readable description of the bounce. this is a
message/delivery-statuspart. - 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 amessage/rfc822part.
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_that_does_not_exists_this_is_just_a_test@gmail.com
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
- RFC6522 about the
multipart/reportpart: The Multipart/Report Media Type for the Reporting of Mail System Administrative Messages - RFC3464 about the
message/delivery-statuspart: An Extensible Message Format for Delivery Status Notifications - RFC3463 about the
message/delivery-statuspart status codes: Enhanced Mail System Status Codes
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: MAILER-DAEMON@silverton.berkeley.edu
To: djb@silverton.berkeley.edu
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.
<god@heaven.af.mil>:
Sorry, I couldn't find any host by that name.
--- Below this line is a copy of the message.
Return-Path: <djb@silverton.berkeley.edu>
Received: (qmail 317 invoked by uid 7); 17 Mar 1996 03:54:38 -0000
Date: 17 Mar 1996 03:54:38 -0000
Message-ID: <19960317035438.316.qmail@silverton.berkeley.edu>
From: djb@silverton.berkeley.edu (D. J. Bernstein)
To: god@heaven.af.mil
Subject: are you there?
Just checking.
qmail bounce messages references
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
