procmail
[Top] [All Lists]

Re: how to reply with textfile?

1997-07-28 11:24:00
Quoting Tomas Karlsson (webmaster(_at_)iimagers(_dot_)com):
I am new to this list as well as to procmail... I was wondering how a 
procmail recipe would look like if I want an autoreply sending out a 
textfile depending on the from field. 

Am I on the right track, trying something like this (which of course 
doesn't work):

:0
* ^From(_dot_)*someone(_at_)domain(_dot_)com
| cat $HOME/somefile.txt ) | $SENDMAIL -t

Hmm. What's this for? -----^

If you copied this from something else, you've left out the formail
part. formail is used to set the headers so that sendmail knows
who to send to. Try this:

:0h
* ^From[        ]*someone(_at_)domain(_dot_)com
*!X-Loop: you(_at_)your(_dot_)domain
| (formail -r -t -I"From: Your Name <you(_at_)your(_dot_)domain>"\
   -I"X-Loop: you(_at_)your(_dot_)domain"\
   -I"Subject: whatever"; \
   cat $HOME/somefile.txt) | $SENDMAIL -t

Now the parens combine the output of formail and cat. The X-Loop is
intended to prevent mail loops in case something is misconfigured.
Everything else should be pretty clear, and you can check the formail
man page to get more info about its options.

-- 
Michael Stone, Sysadmin, ITRI     PGP: key 1024/76556F95 from mit keyserver,
mstone(_at_)itri(_dot_)loyola(_dot_)edu            finger, or email with 
"Subject: get pgp key" 

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