procmail
[Top] [All Lists]

Re: using procmail to just send mail

1996-06-11 12:31:09
Ken Valcourt asked some time ago,

|        When I send mail from my account, I would like the Sender: field
|         to be munged and replaced.  ... 

|         Also, I am sending this mail after receiving an incoming msg that
| starts procmail.  Can I use the functions of procmail on outbound messages
| (i.e. I did not get an inbound message to kick off procmail)?

If your mail user agent allows you to define which program to call next (the
default being the MTA, of course), then, yes, you can feed your outgoing mail
to procmail instead of the MTA.  (The -m option is perfect for that, because
it saves the positional parameters that the MUA tries to tell the MTA.)  Then
procmail (called with a different rcfile, usually, from the one that handles
your incoming mail) can call formail with a filter recipe to change the
headers as you wish and as it determines and finally feed the result to the
real MTA, something like this:

 #!/path/to/procmail/binary -m

 :0fWh # fix headers
 * conditions if any
 | formail -I "Sender: whatever"

 :0 # dispatch to MTA
 ! "$@"

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