Friday, November 7, 2003 03:07 PM
Look up (e.g. at www.imc.org) the RFC's concerning DSN (Delivery Status Notification), which is the official way now, to return such "MAILER-DAEMON bounces".
I think you might end up having to look for a number of clues, in the envelope (e.g. the null sender "<>" is supposed to be used for bounces), headers, and even parse the body content too (e.g. the DSN status/failure codes are, I think, only present in the body text. And there will be a multipart content-type with an embedded text/rfc822 where the bounced original message might be included, at least sometimes, though not always).
And even this will only work for bounces from well-designed mailers that implement the standards correctly. Hopefully, though, most of your clients will be using such mail systems......