in reply to Detecting bounced mails

There is NO standard on headers in the body of an email that everyone adheres to. So a catchall will be hard to do. for instance, try telnetting to port 25 on some random mail server, with a standard ehlo, from,to (fake it of course to get a bounce) and a blank line for the data portion.

You'll see that it goes through fine sending out email, and you should expect no less from any mail coming to you, from a user or a server. What you can count on statistically is, that there a large handful of servers and how they send out MAILER-DAEMON like errors. Qmail likes to whine about the bounces bouncing, and sendmail with it's, i tried for 5 days type thing. My advice is, to find people who run qmail, sendmail, exchange, yahoo.com's, msn.com's and a bunch of others and learn how their bouceback messages look. I can't say they all do one specific thing, as it is up to them to dictate how things work on their end.

But good choice on languages though. Perl/PERL/perl is a good choice of languages to do this type of work with.