procmail
[Top] [All Lists]

Re: filter number(_at_)foobar(_dot_)com

1999-08-14 13:01:03
At 18:42 1999-08-14 +0200, Christophe Zwecker wrote:

On that first recipe, yes, it is a pipe symbol. Means "or". May I suggest that while you're experimenting with this script that you DO NOT trashbin everything to /dev/null, and instead drop them into a file like 'trashbin'. After a while, you can examine the contents of that file and make sure you're not trashing things that you shouldn't. THEN you can switch to /dev/null if when you're sure things are working.

* ^TO.*
| mimedump | grep -v Content- | >> /var/spool/mail/mailfile


If this is the default delivery you're assuming will take place after the previous filter trashbins everything else, then the empty condition line is unneccessary. Just don't use a condition. To clarify the relationship between this recipe and the one preceeding, you could use the E flag (see 'man procmailrc'), though since the preceeding recipe is a stop point, that isn't necessary. As long as you're manipulating a file, you should LOCK this recipe. Just add a ':' at the end of the flags line. Next, eliminate the pipe after the grep: pipe is used for redirecting into a program, and ">"/">>" are used to redirect into a file. After grep, you're not pumping it into a program, you're just dumping the results to a file. And lastly, add a caret '^' before Content in the grep operation. Why? Because your grep will currently match any line containing "Content-", whether at the start or not. You'd be better off using formail to strip these headers, since your grep, even with the caret, won't distinguish between lines appearing in the header, and those in the body.

:0:
| mimedump | grep -v ^Content- >> /var/spool/mail/mailfile


It shouldn't be too difficult to strip the headers with formail, but I haven't been following your thread enough to know what the mimedump process is doing outputting. Theoretically, the following should work, but might not if I'm presuming incorrectly:

:0:
| mimedump | formail -b -I "Content-" >> /var/spool/mail/mailfile


Note that you could add a 'c' (copy) flag on the grep version, then add this after that, but output it to a different file, and inspect it manually.

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

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