EmailDiscussions.com

EmailDiscussions.com (http://www.emaildiscussions.com/index.php)
-   FastMail Forum (http://www.emaildiscussions.com/forumdisplay.php?f=27)
-   -   Define rules question (http://www.emaildiscussions.com/showthread.php?t=27621)

jolycu 1 Oct 2004 12:11 AM

Define rules question
 
When defining a rule to reject an email, does capitalization count? For instance, if I define a rule to look in the subject for "Mail," would that automatically reject "mail" and "email" too? What if a word in the suject contained "Mail" such as "Mailman," would that be rejected by the reject rule for "Mail?" I'm trying to set up some rules to reject (silently, of course) all these undeliverable mail notices I've been getting from being JoeJobbed.
Thanks
Jolycu

Daniel S 1 Oct 2004 04:38 AM

No, yes, yes.

By default, the matches are case-insensitive and match any substring (i.e. not "full words only" match).

Both can be changed by using the Look In: Advanced option (by writing custom tests).

A case-sensitive full-words match for "Mail" in the "Subject" header is:

Code:

header :comparator "i;octet" :regex ["Subject"] ["[^[:alpha:]]Mail[^[:alpha:]]"]
"[^[:alpha:]]" means a non-alphabetic character.

jolycu 1 Oct 2004 09:34 AM

Thanks Daniel S. If I copy your rule into the Look In-Advanced section, would that work, or do I need to add anything to it? I'm not sure I understand about the alpha business. Thanks again for taking the time to help me out.
Jolycu

Daniel S 1 Oct 2004 06:43 PM

Just copy it to the "For text matching" section after setting "Look In" to "Advanced". You don't need to add anything else in the textbox.

[^[:alpha:]] matches one non-alphabetic character (a space, for example). The 'e' in "email" is not a non-alphabetic character, so the rule won't match it; the space (and start-of-string) are a non-alphabetic characters, so the string "Mail " would be matched.

In general, if the string "Mail" is part of a longer word (e.g., "Mailman") it would either be followed or preceded by an alphabetic character ('m'). By matching non-alpha before and after the string, I make sure it is not part of a longer word.

edit:

An easier way to match full words is to use the word boundary character, '\b':

Code:

header :comparator "i;octet" :regex "Subject" "\\bMail\\b"

jolycu 6 Oct 2004 11:29 PM

Thanks Daniel S. I'll give it a shot.


All times are GMT +9. The time now is 07:10 PM.


Copyright EmailDiscussions.com 1998-2022. All Rights Reserved. Privacy Policy