procmail
[Top] [All Lists]

Re: Email Filters

2009-06-17 15:53:46
At 15:14 2009-06-17 -0400, rmp dmd wrote:
I'm looking for ways to disregard emails based on from address or subject. Mails will be coming for <mailto:user1(_at_)domain(_dot_)net>user1(_at_)domain(_dot_)net but I do not want the mails,

Would you be doing this in a global procmailrc (which is logically maintained by the system administrator and which would normally apply to all users, but can have conditions for specific recipients), or within the users own .procmailrc? Iis this YOUR account, or someone elses'? The approach differs.

Basically though, yes, procmail can do what you're asking -- specfically what has to be written depends on more specifics from you.

For instance, in the users' ~.procmailrc:

:0
* 9876543210^0 ^From:[ ]*\<<mailto:alertnotications(_at_)ml(_dot_)com>alertnotications(_at_)ml\(_dot_)<mailto:alertnotications(_at_)ml(_dot_)com>com
* 9876543210^0 ^Subject:[       ](failure notice|\*\* RECOVERY .* OK \*\*)
discard.mbx

Eventually, you'd change 'discard.mbx' to /dev/null, but when learning, it's best to NOT actually send things into the ether, lest you dispose of all your mail due to a typo. That file will get created in the user directory - you can specify another location for it if need be, but once you have the filter running and known working, you can change it to /dev/null, and then it won't matter.

If the user's specific address must appear as a cleartext recipient (i.e. NOT bcc'd), there's an additional condition to add, and if the user has multiple addresses which are delivered (say, via wildcard) to the same mailbox, but you want this filtering only for the ones to that specific address, you'd really need to set up an alias at the MTA level to invoke procmail to filter for that ONE address, and then forward it from there to the underlying user account.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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