in reply to Re: Dealing with returned mail
in thread Dealing with returned mail

If you're using exim as your MTA you can set up a system filter to identify bounce messages for you. For example:
if error_message then pipe "/usr/local/bin/handlescript" finish endif

will pipe all bounce messages to your script and then discard them. That way your perl script only gets called for true bounce messages, which reduces the overhead.

If you want the bounced email to be delivered to the script but also to the original sender, just omit the "finish" keyword.