Copying all mail to Archive

The sendmail FAQ includes a reference to a comp.mail.sendmail posting using only 33AA593A.4B701C3F@syntegra.nl for the citation. While some users might know to go to the Google Groups "Advanced Search" page, others may not. I expect this page will come up for anyone searching in the Google web engine for that message-id, thus letting the uninitiated see the posting referred to.

If you are interested in this, you may also be interested in an alternative. which contains instructions for saving copies of all messages using a different methodology. If you only need to save incoming messages, see an easy alternative.

Viewing message <33AA593A.4B701C3F@syntegra.nl> From: Homme Bitter (H.Bitter@syntegra.nl) Subject: Solution for copying all mail to archive Newsgroups: comp.mail.sendmail View: (This is the only article in this thread) | Original Format Date: 1997/06/20 It took me some time, but, I have it solved... This can also be used as a general purpose mailfilter too, excellent for detecting spam and other unpleasant things. Solution: Let sendmail map everything through procmail, let procmail do to your mail whatever you want with it and map it back. That was the easy part... Now for the syntax. Add some local rules to your m4 config file ( use m4, ALWAYS ! ). MAILER(`procmail')dnl LOCAL_RULE_0 R$*<@$*.procmail>$* $1@<$2>$3 map back of procmail copy LOCAL_RULE_0 R$*<@$+>$* $#procmail $@/etc/procmailrc $:$1@$2procmail$3 send all external mail to procmail this will send all mail through procmail using the file /etc/procmailrc as the config file for procmail. I use this one: :0 c: /var/mail/archive Once I found this all out ( with a little help, I might add ). it all seemed so simple.... Maybe this would be a good item to add to the faq, since it is a general purpose add on for sendmail that can be used for many useful purposes. Known problems: Sending to a top leve domain doesn't work, it somehow looses a dot, but then again, there are no mailaddresses in toplevedomains, to my knowledge, so, who cares. This version only works for mail wit a @ sign in the address, it's kind of hard to split up an address that consists of only one string. Good luck, I hope the mail-commutity is happy with this. Homme Also see this message: From: Per Hedeland (per@hedeland.org) Subject: Re: Using procmail to archive outbound fails - buildaddr: no user Newsgroups: comp.mail.sendmail View this article only Date: 2002-04-13 03:30:06 PST In article <m1vgawb6x8.fsf@reader.newsguy.com> Harry Putnam <reader@newsguy.com> writes: > > MAILER(`procmail')dnl > LOCAL_RULE_0 > R$*<@$*.procmail>$* $1@<$2>$3 map back of procmail copy > LOCAL_RULE_0 > R$*<@$+>$* $#procmail $@/etc/procmailrc $:$1@$2procmail$3 send all > external mail to procmail > >After first getting the tabs right (I think), I inserted the above >into my.mc and generated sendmail.cf You *didn't* get the tabs right - it should be like this (no need for multiple LOCAL_RULE_0 directives), where I have used <TAB> instead of actual tab(s): LOCAL_RULE_0 R$*<@$*.procmail>$*<TAB>$1@<$2>$3<TAB>map back of procmail copy R$*<@$+>$*<TAB>$#procmail $@/etc/procmailrc $:$1@$2procmail$3<TAB>send all external mail to procmail Btw, it's probably better to do this with a milter these days. --Per Hedeland per@hedeland.org Here is the entire thread