I need to write a script that will check a catch-all mailbox (pop3) and send
a non delivery report back to the sender of the email.

Background info:
I have a domain hosted on a site that offers unlimited email accounts...
the problem is, emails sent to an invalid address on the domain aren't
automatically returned as non-deliverable. I am, however, able to set up a
catch-all address and able to pick up those emails. Id like to set up a
script that checks that account and generates an appropriate ndr that looks
like the following:

Your message

To: email@domain.com
Subject: test non delivery
Sent: Sun, 2 Jan 2005 20:42:39 -0500

did not reach the following recipient(s):

email@domain.com on Sun, 2 Jan 2005 20:42:39 -0500
The e-mail account does not exist at the organization this message
was sent to. Check the e-mail address, or contact the recipient
directly to find out the correct address.
<server.domain.com #5.1.1>

And if possible, return the original message as an attachment as a normal
non delivery report would.

--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.

Mike Brearley