procmail
[Top] [All Lists]

Re: Can someone else help Brian Dupras, please?

2001-08-31 22:38:21
Again, I engaged my fingers before my brain. :-(

On  1 Sep, Don Hammond wrote:
| On 31 Aug, David W. Tamkin wrote:
|| [...] 
|| so that messages he sends to his other account can be remailed from it to
|| the addresses in To:, Cc:, or Bcc: lines at the top of the body?  Thank you
|| so much.
|| 
| 
| [...] I don't
| know what he was getting at with the -X "" option to formail, so I'll
| leave that to him when he gets time. 

What he's getting at is being able to move headers in the new message
directly from the body of the original. It's very cool, and it allows
for any or all of To:, Cc:, Bcc: and multiple recipients in each to be
passed for the new message. IOW, much better than the stab I took.

The new headers which you want to appear must start in the first line of
the body of as before, and there must be a blank line after words. So
for example, a meesage that looks like:

From: me(_at_)my(_dot_)work(_dot_)com
To: me(_at_)my(_dot_)house(_dot_)com
Subject: How's about dat

To: friend(_at_)somewhere(_dot_)else(_dot_)com
cc: anotherfriend(_at_)somewhere(_dot_)different(_dot_)com

Wazzup.

will become:

From: me(_at_)my(_dot_)house(_dot_)com
Subject: How's about dat
To: friend(_at_)somewhere(_dot_)else(_dot_)com
cc: anotherfriend(_at_)somewhere(_dot_)different(_dot_)com

Wazzup.

The recipe looks like:

:0 fhw
* [ enough conditions here to make it highly
*   unlikely that anybody abuses the facility ]
| formail -ITo: -ICc: -I "From: $LOGNAME(_at_)$HOST" -X ""

:0a
|$SENDMAIL -t

The formail pipe eliminates To: and Cc: from the original, rewrites
From:, and removes the line between the headers and the body,
effectively making the first lines of the "old" body part of the "new"
headers. -t tells sendmail to scan the headers for recipients so each
person in the new To:, Cc:, or  even a Bcc: will be mailed a copy. Make
sure there's a blank line after the "headers" that are embedded in the
body of the original message, because that'll be the new line between
headers and body.  The only thing I'd stress is making sure you
prevent abuse from third parties. I'll bet David has a good suggestion
on that score. He's a smart guy. ;-)

-- 
                   /"\
Don Hammond        \ /     ASCII Ribbon Campaign
Raleigh, NC US      X        Against HTML Mail,
                   / \      and News Too

_______________________________________________
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>