procmail
[Top] [All Lists]

Re: Newbie needs help

2003-02-06 16:48:14
Paul Tram wrote:
:0:
* !^From:(_dot_)*email1(_at_)hotmail(_dot_)com
* !^From:(_dot_)*email2(_at_)hotmail(_dot_)com
* !^From:(_dot_)*email3(_at_)yahoo(_dot_)com
* !^From:(_dot_)*somebody(_at_)yahoo(_dot_)com
* !^From:(_dot_)*friend(_at_)aol(_dot_)com
* !^From:(_dot_)*friend(_at_)hotmail(_dot_)com
* !^From:(_dot_)*brother(_at_)serv(_dot_)net
* !^From:(_dot_)*sister(_at_)qwest(_dot_)net
* !^To:(_dot_)*procmail(_at_)lists(_dot_)rwth-aachen(_dot_)de
* !^Subject:.*CyberDojo
* !^From:(_dot_)*(_at_)somemailinglist(_dot_)com
Spam


Well, let me sow more detail then.


You can (means: I would) group all addresses(_at_)some(_dot_)domain like this:

  * ! ^From:.*(email1|email2|friend)@hotmail.com


Further, as was shown and mentioned, you should escape dots:

  * ! ^From:.*(email1|email2|friend)@hotmail\.com


It's infinitely better to use the Sender: header for the procmail-list:

  * ! ^Sender:.*procmail-admin@


But From:'friend(_at_)aol(_dot_)com(_dot_)cn' will not go to Spam.

So how would I go about processing such an email?

Try to detect that the address is not yet completed (@hotmail.com.tw,
@hotmail.com_is_not.com). That is certainly the case when a character
from [-+a-z0-9.$_~] follows. So assume it's ended when a-character-not-
from-that-set (or a newline) follows. A regexp for that is
([^-+a-z0-9.$_~]|$), which should be appended to the condition:

  * ! ^From:.*(email1|email2|friend)@hotmail\.com([^-+a-z0-9.$_~]|$)


A similar problem is at the start of the address. remail2(_at_)hotmail(_dot_)com
would get through, unless you protect the start as well:

  * ! ^From:.*[^-+a-z0-9.$_~]\
      (email1|email2|friend)@hotmail\.com
      ([^-+a-z0-9.$_~]|$)

But then 'From:email2(_at_)hotmail(_dot_)com' would lead to Spam, so you need
(.*[^-+a-z0-9.$_~]|), which makes the condition:

  * ! ^From:(.*[^-+a-z0-9.$_~]|)\
      (email1|email2|friend)@hotmail\.com\
      ([^-+a-z0-9.$_~]|$)


Maybe you will often get away with:
  * ! ^From:(.*\<|)(email1|email2|friend)@hotmail\.com(\>)

but \< and \> are shorthands for ([^a-zA-Z0-9_]|$), which both limits
(because the characterset is smaller) and extends (because it includes
newline) the test, and that can lead to unexpected matches, so don't 
use it.


An update-friendly way to use all this, is:
   :0:
   * ! ^From:(.*[^-+a-z0-9.$_~]|)(\
         (email1|email2|friend)@hotmail\.com|\
         (email3|somebody)@yahoo\.com|\
         friend(_at_)aol\(_dot_)com|\
         (brother(_at_)serv|sister(_at_)qwest)\.net|\
       @@)([^-+a-z0-9.$_~]|$)
   * ! ^From:(_dot_)*(_at_)somemailinglist\(_dot_)com|\
   * ! ^Sender: procmail-admin@
   * ! ^Subject:.*\[CyberDojo]
   * ! ^TO_(myaddress1|myaddress2)@domain1\.tld([^-+a-z0-9.$_~]|$)
   Spam

The @@ is just a dummy, so that all address-lines can (and should)
end in |\.

It's better to replace the '^From:(_dot_)*(_at_)somemailinglist\(_dot_)com' with
a more accurate header ('Sender:' or some 'List-' header).

-- 
Affijn, Ruud

Easy people don't care too much.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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