procmail
[Top] [All Lists]

Re: How to redirect STDIN in procmailrc

2001-03-14 08:24:48
I asked about storing mail in a folder and then sending it out later
on the basis of information coming in a later mail. 

On Tue, 13 Mar 2001, David W. Tamkin responded:

 
|     :0
|     | cat Mail/$GROUP/$PARTNER_ID | formail -s formail -k
|     -XSubject: -I "X-Loop: penpals-anonymous" -XX-Loop: -I
|     "From: penpals-anonymous" -XFrom: -I "To: $SENDER_ADDRESS"
|     -XTo: | $SENDMAIL $SENDMAILFLAGS $SENDER_ADDRESS


| ... Formail -s flag does not seem to be dividing
| up the emails in Mail/$GROUP/$PARTNER_ID being sent out on STDIN
| by cat or the redirection operator... 

It is, but you're undoing it by piping the output to $SENDMAIL instead of
letting formail -s invoke $SENDMAIL, and you don't need the double formail
call either, because formail -s can change header lines on every component
message that it splits out.

 :0
 | formail -k -XSubject: -A "X-Loop: penpals-anonymous" -XX-Loop: \
 -I "From: penpals-anonymous" -XFrom: -I "To: $SENDER_ADDRESS" -XTo: -ds \
 $SENDMAIL $SENDMAILFLAGS "$SENDER_ADDRESS" < Mail/$GROUP/$PARTNER_ID

Thanks, that did the trick. I noticed you double-quoted
"$SENDER_ADDRESS". I didn't do that, but it still worked. Perhaps
it has something to do with passing the arguments to the other
program. I had no spaces in $SENDER_ADDRESS, there being only one
address, but this could change in the future, so before I put it
into production, I will double quote it. 

Thanks again, I never would have been able to work out that the
pipe to $SENDMAIL was undoing all of the -s flag's work. 

-- 
Greg Matheson                    Teaching: computer programming
Chinmin College,                 done by monkeys.
Taiwan                           
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>