How to safely identify a DSN (delivery status notification) message
Asked Answered
C

1

5

I'm fetching emails from a POP3 server and I'd like to make a difference between a regular email and DSN (Delivery Status Notification) / NDR (Non-Delivery Report/Receipt) messages.

What is the best/safest way to identify those messages? Are there any particular message-headers I should be looking for?

Thanks in advance!

Churlish answered 23/6, 2010 at 14:52 Comment(1)
Google VERP and BATV, two techniques for IDing NDRs.Slipshod
C
7

Some mail servers implement RFC 3464. Those that do will typically generate Delivery Status Notifications with a message header Content-Type of multipart/report and three component parts (text/plain, message/delivery-status and message/rfc822). So you could detect those characteristics of the message and process accordingly. The message will generally look like this:

From: "Mail Delivery System" <[email protected]>
Subject: Delivery Status Notification (Failure) Content-Type: multipart/report; report-type=delivery-status

Content-Type: text/plain A human readable explanation of the Delivery Status Notification.

Content-Type: message/delivery-status A structured machine readable reason for the Delivery Status Notification.

Content-Type: message/rfc822 The original message.

For those mail servers that generate Delivery Status Notifications in an unstructured format, it is probably still necessary to detect their notifications by analysing the text of the From: and Subject: message headers.

Clubwoman answered 1/2, 2011 at 20:23 Comment(3)
The key word is your first word: Some.Slipshod
@Slipshod what has been your experience? How do the numbers break down? Do most implement this?Devorahdevore
I think a better answer, @AranMulholland, is "what is your experience"? IOW, you're going to need to look at the traffic you receive to identify their DSN characteristics. Headers, subject, and bodies can all contain clues.Slipshod

© 2022 - 2024 — McMap. All rights reserved.