I have been using net::pop3 to actually retrieve the email and then parse it, but I can't capture the actual body of the message. If I use:
$MsgHeader = $pop3 ->top(msg_id);
Then I get an array reference with all the header information. But when I do,
$MsgContent = $pop3 ->get(msg_id);
Then I get the entire header PLUS the body. The immediate solution to me seemed to be if I could convert the array references into strings, then I can substitute the header out of the message, but all attempts have failed. SO
1) How can I store the contents of an array reference into a single string?
2) Does anyone else have any better ideas at how to do this?
~Joe Donahue
That first part is overhead. After the MTA accepts the email from the remote site, you hook your program in such that it sends the email to your STDIN.
For example, in sendmail you can add an alias:
mailman: "¦/var/mailman/mail/mailman post mailman"
Anything sent to "mailman@example.com" will get passed through /var/mailman/mail/mailman which processes the email.
You can also do it through procmail (mail filtering) or .forward.
Take a look at your MTA's documentation on how to send email to a program rather than a mailbox. Accepting the email in your program is pretty easy, you do a while (<STDIN>) loop to process the headers and body which are separated by a blank line.
Sean