Parse email delivery status notifications (DSN) ?

Christopher Arndt chris.arndt at web.de
Thu Apr 13 10:59:45 EDT 2006


(please CC me in you replies if possible, I am not on the list)

Hi,

I am trying to write a script, that processes bounced emails from our
mailing campaigns to remove them from the distribution list and to
update the customer database.

Since our mailing program is not able to set the "Return-Path" header to
a separate address, but always sets it to the "From" address or the
"Reply-To" (if any), I need a way to distinguish DSNs from normal
replies to that mail box.

Is anybody aware of ready solutions to parse DSNs with Python? I would
just need to check if a mail is a DSN and retrieve the failed email address.

I know, this could probably done with the email module and some regexes,
but I would like to avoid ploughing through RFC 3464 to figure out the
formatting rules, if I can.

A quick search on this list and in the Cookbook, did not turn up
anything useful. I guess, mailman should already have code for this, but
can it be used on it's own?

Any pointers appreciated!

Cheers, Chris



More information about the Python-list mailing list