in reply to email parsing
How are you piping the email to the script?
If you were using postfix to recieve your email, I would say that you were attempting to send mail to a pipe from inside /etc/postfix/virtual This can't be done. Guessing wildly you need to do your piping in your alias file and send your mail to the alias.
In Section
Seekers of Perl Wisdom