rhxk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, My objective is to capture emails coming to my account & parse/play/store them. So I have my .procmailrc as:
VERBOSE=on LINEBUF=1000000 LOGFILE=/home/rob/procmail.log FROM=`formail -zxFrom:` SUBJECT=`formail -zxSubject:` BODY=`formail -I ""` :0w: /home/rob/.lockfile | /home/rob/bin/forward_email -from $FROM -subject $SUBJECT -body $BOD +Y
1 problem:
The $FROM is "FirstName LastName <email@addr.com>"
The $SUBJECT may be anything & contain anything...including double quotes, spaces, etc.etc.....
The $BODY may be a 15K text.....
Can anyone give me any ideas how to pass the
from,subject,body to perl so that it can receive it
correctly? ....thanx.....

Replies are listed 'Best First'.
Re: multiple parameters?
by Errto (Vicar) on Oct 26, 2005 at 01:34 UTC
    Don't bother passing those on the command line. Since you are piping the data to your program from procmail, you can process the text on STDIN using a module such as Mime::Parser. Alternatively, you can access the environment variables you've already set for yourself. Something like:
    my ($from, $subj, $body) = @ENV{qw(FROM SUBJECT BODY)};
Re: multiple parameters?
by philcrow (Priest) on Oct 25, 2005 at 21:07 UTC
    I'm no expert on this, but in Advance Perl Programming, Simon Cozens points to Mail::Audit which has a procmail parser.

    Phil