I need a script that will be setup as a catch-all pipe for an internet domain, called each time an email is? received:
anyaddresshere@[login to view URL]
The script should look up the user part of the email, in the above case "anyaddresshere," and resend the email to an email for that user.
For the purposes of testing it can look up the real email in a hard coded hash. The real script will use a database, but ? I can add that.?
If it doesn't find someone to send the email to for that address, it should simply exit the script.
If there is a forward address on file example:
anyaddresshere@[login to view URL] -> someguy@[login to view URL]
Then it should forward that email off. It need not change the email header, as the From address should be preserved. But it should modify the body of the message. If the message is in HTML then it should append that MIME type, as well as text. If the email is just text then it only needs to append the text. The part it adds should be simple:
"Email forwarded for? anyaddresshere@[login to view URL]" where the email is the email the? original? email was sent to.
Prefer the coding to be done in PERL.