procmail/formail syntax question
I'm trying to get procmail to rewrite the TO: header. I've tried something like: TO=`formail -xTo:` # is moved to viruses. :0: * ^X-Virus-Status: Yes | formail -I To: is_virus, $TO # Mails with a score of 15 or higher are almost certainly spam (with 0.05% # false positives according to rules/STATISTICS.txt). Let's put them in a # different mbox. (This one is optional.) :0: * ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* | formail -I To: certainly_spam, $TO # All mail tagged as spam (eg. with a score higher than the set threshold) # is moved to probably-spam. :0: * ^X-Spam-Status: Yes | formail -I To: probably_spam, $TO But this does not seem to be working. What am I doing wrong? -- U.S. Encouraged by Vietnam Vote - Officials Cite 83% Turnout Despite Vietcong Terror - New York Times 9/3/1967 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: procmail/formail syntax question
On Sun, Oct 23, 2005 at 03:09:51PM -0400, stan wrote: I'm trying to get procmail to rewrite the TO: header. I've tried something like: TO=`formail -xTo:` I think this command is expanded only once, and gives an empty string because you didn't give formail any input. # is moved to viruses. :0: * ^X-Virus-Status: Yes | formail -I To: is_virus, $TO snip But this does not seem to be working. What am I doing wrong? Why don't you put it in an appropriate mailbox directly? E.g: :0: * ^X-Virus-Status: Yes /home/username/Mail/virus :0: * ^X-Spam-Status: Yes /home/username/Mail/probably_spam Roland -- R.F.Smith (http://www.xs4all.nl/~rsmith/) Please send e-mail as plain text. public key: http://www.xs4all.nl/~rsmith/pubkey.txt pgpk5BDfQAFVK.pgp Description: PGP signature
Re: procmail/formail syntax question
On Sun, Oct 23, 2005 at 10:07:17PM +0200, Roland Smith wrote: On Sun, Oct 23, 2005 at 03:09:51PM -0400, stan wrote: I'm trying to get procmail to rewrite the TO: header. I've tried something like: TO=`formail -xTo:` I think this command is expanded only once, and gives an empty string because you didn't give formail any input. # is moved to viruses. :0: * ^X-Virus-Status: Yes | formail -I To: is_virus, $TO snip But this does not seem to be working. What am I doing wrong? Why don't you put it in an appropriate mailbox directly? E.g: :0: * ^X-Virus-Status: Yes /home/username/Mail/virus :0: * ^X-Spam-Status: Yes /home/username/Mail/probably_spam That is _exactly_ wht _I_ do. However this is for a friend who recieves mail on this machine, then uses IMAP to fecth it to a Windoze box where he reads it with Outlook. He aparently does not now how to filter within Outlook on anything but the subject. So, I need to be able to rewrite the subject. Yes it's dumb but -- U.S. Encouraged by Vietnam Vote - Officials Cite 83% Turnout Despite Vietcong Terror - New York Times 9/3/1967 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: procmail/formail syntax question
On 2005-10-23 17:49, stan [EMAIL PROTECTED] wrote: On Sun, Oct 23, 2005 at 10:07:17PM +0200, Roland Smith wrote: On Sun, Oct 23, 2005 at 03:09:51PM -0400, stan wrote: I'm trying to get procmail to rewrite the TO: header. I've tried something like: TO=`formail -xTo:` I think this command is expanded only once, and gives an empty string because you didn't give formail any input. # is moved to viruses. :0: * ^X-Virus-Status: Yes | formail -I To: is_virus, $TO snip But this does not seem to be working. What am I doing wrong? Why don't you put it in an appropriate mailbox directly? E.g: :0: * ^X-Virus-Status: Yes /home/username/Mail/virus :0: * ^X-Spam-Status: Yes /home/username/Mail/probably_spam That is _exactly_ wht _I_ do. However this is for a friend who recieves mail on this machine, then uses IMAP to fecth it to a Windoze box where he reads it with Outlook. He aparently does not now how to filter within Outlook on anything but the subject. So, I need to be able to rewrite the subject. Yes it's dumb but ``Much confusion in you I sense, young Jedi.'' If you want to rewrite the *SUBJECT* of the messages, then why are you trying to rewrite the *RECIPIENT* header? Having said that, I think that what you're missing is the 'f' option in the rule that pipes mail to formail and that you don't really need formail for something as simple: :0 Hf * X-Virus-Status: Yes | sed -e 's/^[sS]ubject:[[:space:]]\+/Subject: [virus] ' ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: procmail/formail syntax question
On Mon, Oct 24, 2005 at 01:13:18AM +0300, Giorgos Keramidas wrote: On 2005-10-23 17:49, stan [EMAIL PROTECTED] wrote: On Sun, Oct 23, 2005 at 10:07:17PM +0200, Roland Smith wrote: On Sun, Oct 23, 2005 at 03:09:51PM -0400, stan wrote: I'm trying to get procmail to rewrite the TO: header. I've tried something like: TO=`formail -xTo:` I think this command is expanded only once, and gives an empty string because you didn't give formail any input. # is moved to viruses. :0: * ^X-Virus-Status: Yes | formail -I To: is_virus, $TO snip But this does not seem to be working. What am I doing wrong? Why don't you put it in an appropriate mailbox directly? E.g: :0: * ^X-Virus-Status: Yes /home/username/Mail/virus :0: * ^X-Spam-Status: Yes /home/username/Mail/probably_spam That is _exactly_ wht _I_ do. However this is for a friend who recieves mail on this machine, then uses IMAP to fecth it to a Windoze box where he reads it with Outlook. He aparently does not now how to filter within Outlook on anything but the subject. So, I need to be able to rewrite the subject. Yes it's dumb but ``Much confusion in you I sense, young Jedi.'' If you want to rewrite the *SUBJECT* of the messages, then why are you trying to rewrite the *RECIPIENT* header? Having said that, I think that what you're missing is the 'f' option in the rule that pipes mail to formail and that you don't really need formail for something as simple: :0 Hf * X-Virus-Status: Yes | sed -e 's/^[sS]ubject:[[:space:]]\+/Subject: [virus] ' Yes, Oh freat master, I sense a great confusion :-) It's the To: header he wants rewriten. I'll try your magic spell with To: -- U.S. Encouraged by Vietnam Vote - Officials Cite 83% Turnout Despite Vietcong Terror - New York Times 9/3/1967 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: procmail/formail syntax question
Please do *not* remove the mailing list from the Cc: header, unless there is a very good reason (i.e. confidential information in the message text). On 2005-10-23 19:11, stan [EMAIL PROTECTED] wrote: On Mon, Oct 24, 2005 at 01:13:18AM +0300, Giorgos Keramidas wrote: On 2005-10-23 17:49, stan [EMAIL PROTECTED] wrote: On Sun, Oct 23, 2005 at 10:07:17PM +0200, Roland Smith wrote: On Sun, Oct 23, 2005 at 03:09:51PM -0400, stan wrote: I'm trying to get procmail to rewrite the TO: header. I've tried something like: TO=`formail -xTo:` :0 Hf * X-Virus-Status: Yes | sed -e 's/^[sS]ubject:[[:space:]]\+/Subject: [virus] ' Mmm, we are close here I put in: # test :0 Hf | sed -e 's/^[tT]o:[[:space:]]\+/To: [STAN] ' (Unconditional to test the action). That's plainly wrong. The To: header will contain broken crap instead of a recipient address. Just *DON'T* do that. Try to modify the Subject: instead. I'm positively sure than even the crapware from a well-known Redmond-based company can filter based on the subject of individual posts. But I got this error in the procmail logfile: sed: 1: s/^[tT]o:[[:space:]]\+/ ...: unescaped newline inside substitute pattern It may be that procmail does weird things with the regexp string or that procmail doesn't accept extended regexps (I think I remember finding out about this one a while ago). Let's see: % flame:/home/keramida$ cd /tmp/stan/ % flame:/tmp/stan$ ls -l % total 6 % -rw--- 1 keramida wheel - 4109 Oct 24 02:13 mbox % flame:/tmp/stan$ cat procmailrc % :0 Hf % | sed -e 's/^[tT]o:[[:space:]]\+/To: [STAN] ' % flame:/tmp/stan$ formail -s procmail /tmp/stan/procmailrc mbox | grep -i to: % sed: 1: s/^[tT]o:[[:space:]]\+/ ...: unescaped newline inside substitute pattern % flame:/tmp/stan$ When I avoid using the \+ trick, it works fine: % flame:/tmp/stan$ cat procmailrc % :0 Hf % | sed -e 's/^[tT][oO]:[[:space:]][[:space:]]*\([^[:space:]]\)/To: [STAN] \1/' % % :0 % /tmp/stan/newbox % flame:/tmp/stan$ formail -s procmail /tmp/stan/procmailrc mbox % flame:/tmp/stan$ ls -l % total 14 % -rw--- 1 keramida wheel - 4109 Oct 24 02:13 mbox % -rw--- 1 keramida wheel - 4116 Oct 24 02:20 newbox % -rw-rw-r-- 1 keramida wheel - 105 Oct 24 02:19 procmailrc % flame:/tmp/stan$ diff -u mbox newbox % --- mboxMon Oct 24 02:13:03 2005 % +++ newbox Mon Oct 24 02:20:05 2005 % @@ -36,7 +36,7 @@ % for [EMAIL PROTECTED]; Sun, 23 Oct 2005 19:11:03 -0400 % Date: Sun, 23 Oct 2005 19:11:03 -0400 % From: stan [EMAIL PROTECTED] % -To: Giorgos Keramidas [EMAIL PROTECTED] % +To: [STAN] Giorgos Keramidas [EMAIL PROTECTED] % Subject: Re: procmail/formail syntax question % Message-ID: [EMAIL PROTECTED] % References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] So it *does* work, using plain regexps and not extended regexps and it changes the To: header as expected (even though that's wrong, as I said above). - Giorgos ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: procmail/formail syntax question
On 2005-10-23 18:56, stan [EMAIL PROTECTED] wrote: On Mon, Oct 24, 2005 at 01:13:18AM +0300, Giorgos Keramidas wrote: On 2005-10-23 17:49, stan [EMAIL PROTECTED] wrote: On Sun, Oct 23, 2005 at 10:07:17PM +0200, Roland Smith wrote: On Sun, Oct 23, 2005 at 03:09:51PM -0400, stan wrote: I'm trying to get procmail to rewrite the TO: header. I've tried something like: TO=`formail -xTo:` [...] So, I need to be able to rewrite the subject. Yes it's dumb but ``Much confusion in you I sense, young Jedi.'' If you want to rewrite the *SUBJECT* of the messages, then why are you trying to rewrite the *RECIPIENT* header? Having said that, I think that what you're missing is the 'f' option in the rule that pipes mail to formail and that you don't really need formail for something as simple: :0 Hf * X-Virus-Status: Yes | sed -e 's/^[sS]ubject:[[:space:]]\+/Subject: [virus] ' Yes, Oh freat master, I sense a great confusion :-) It's the To: header he wants rewriten. You can always hit the Windows user hard on the head with a cluebat. All the mail reading software for Windows that I've recently had to work with supports filtering by the _SUBJETC_ of the messages too :-) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: procmail/formail syntax question
On Mon, Oct 24, 2005 at 02:25:30AM +0300, Giorgos Keramidas wrote: Please do *not* remove the mailing list from the Cc: header, unless there is a very good reason (i.e. confidential information in the message text). Sorry, I hit r instead of l in mutt. My apoligies. -- U.S. Encouraged by Vietnam Vote - Officials Cite 83% Turnout Despite Vietcong Terror - New York Times 9/3/1967 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: procmail/formail syntax question
On 2005-10-23 19:53, stan [EMAIL PROTECTED] wrote: On Mon, Oct 24, 2005 at 02:25:30AM +0300, Giorgos Keramidas wrote: Please do *not* remove the mailing list from the Cc: header, unless there is a very good reason (i.e. confidential information in the message text). Sorry, I hit r instead of l in mutt. My apoligies. That's ok. I usually hit 'g' (group-reply), and it's not too much trouble to Cc: the list again. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: procmail/formail syntax question
On Mon, Oct 24, 2005 at 04:28:49AM +0300, Giorgos Keramidas wrote: On 2005-10-23 19:53, stan [EMAIL PROTECTED] wrote: On Mon, Oct 24, 2005 at 02:25:30AM +0300, Giorgos Keramidas wrote: Please do *not* remove the mailing list from the Cc: header, unless there is a very good reason (i.e. confidential information in the message text). Sorry, I hit r instead of l in mutt. My apoligies. That's ok. I usually hit 'g' (group-reply), and it's not too much trouble to Cc: the list again. hits g Oh, and I learned another mutt command! Another secret mutt user surfaces :-) -- U.S. Encouraged by Vietnam Vote - Officials Cite 83% Turnout Despite Vietcong Terror - New York Times 9/3/1967 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]