Stephen Patterson <s(_dot_)patterson(_at_)freeuk(_dot_)com> writes:
I'm changing my email address soon (the old one doesn't have
server-side spam filtering), and am thinking of using the following
bit of procmail code. Can I replace sendmail with an mbox name (to
send these messages by hand) and expect things to work?
Not quite. The output of "formail -r" doesn't include a leading "From "
line, so you can't just append it to a mailbox without further processing.
Probably simplest is to the pipe the message through formail again; i.e.,
change the last line of the action from:
| /usr/lib/sendmail -oi -t
to
| formail >>some_file
You'll also want to use a locallockfile when delivering to a folder like
that: change the recipe start line from
:0 eh
to
:0 eh:
BTW: instead of writing "/usr/lib/sendmail" in actions, you should use
$SENDMAIL, which is set at compile time in procmail to be the correct
path.
SUBJ_=`formail -c -xSubject: \
| sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
This is more efficiently done using extraction inside procmail:
:0
* ^Subject:[ ]*\/[^ ](.*[^ ])?
{ SUBJ_ = $MATCH }
:0 E
{ SUBJ_ = "<no subject give>" }
Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail