I read that, even before you suggested to.
But the Mail::Message module looks more inviting to me, partly because it seems to be more complete and with easier access to parts of a message.
I'm reading the mail from STDIN with
Mail::Message->read(\*STDIN);
my $absender = $msg->sender;
That gives me an error of
WARNING: Illegal character in field name: From test@example.com Tue Oct 8 09
Can't call method "sender" on an undefined value at myscript.pl line (second line of code).
What am I doing wrong?
| [reply] [d/l] |
I can't say I've used that module, (and it looks to me as if it's more for building mail messages for sending, rather than parsing incoming messages, which is what I assume you're trying to do) but a couple of things spring to mind
- Mail::Message can't handle STDIN - but you're obviously getting something
- Some headers are missing - where are you getting your message from that you're passing to STDIN
- The module doesn't like the @ - it may be that it (and other special characters) need to be escaped before passing through STDIN
BTW, I'm not saying that it is, but you probably don't want to include real email addresses in examples on PM
| [reply] |
Mail Message CAN handle STDIN -
at least http://perl.overmeer.net/mailbox/html/Mail/Message/Construct.html#SYNOPSIS says so
The error got away after I deleted the first line of the message. Please don't ask me why.
| [reply] |