Rules "or" and "and" together

Use this forum if you want to suggest a new feature to hMailServer. Before posting, please search the forum to confirm that it has not already been suggested.
Post Reply
odseg
New user
New user
Posts: 1
Joined: 2013-07-10 10:28

Rules "or" and "and" together

Post by odseg » 2013-07-10 12:21

Good day, i use hmail 5.3, i use many rules and & or , this called one question, is it possible to do use rules "or" and "and" together?
for example: field subject contain some word "OR" body contain some word "AND" field "to" contain some address

sorry for my English

User avatar
jimimaseye
Moderator
Moderator
Posts: 8170
Joined: 2011-09-08 17:48

Re: Rules "or" and "and" together

Post by jimimaseye » 2014-08-03 23:58

I agree. Would be useful. But would be difficult i think.
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Rules "or" and "and" together

Post by ^DooM^ » 2014-08-04 00:18

Yes i have needed this a few times. Normally just turn to scripting if you need more advanced rules.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

User avatar
SorenR
Senior user
Senior user
Posts: 3228
Joined: 2006-08-21 15:38
Location: Denmark

Re: Rules "or" and "and" together

Post by SorenR » 2014-08-04 16:28

I split them into two rules, first rule create a custom header value and second rule check for the header value and the remaining criterias.
SørenR.

“With age comes wisdom, but sometimes age comes alone.”
- Oscar Wilde

User avatar
jimimaseye
Moderator
Moderator
Posts: 8170
Joined: 2011-09-08 17:48

Re: Rules "or" and "and" together

Post by jimimaseye » 2015-03-12 12:11

REGEX is a beauty for helping out in these situations.

EG,

Where

RETURN PATH EQ axp.fraudite.com

and

TO contains USER1
or
TO contains USER2


could be written as

RETURN PATH EQ axp.fraudite.com
and
TO regex (?i:^.*(USER1@|USER2@).*$)


Regex can do CONTAIN, NOT CONTAINS(using the asterix), EQUALS, NOT EQUALS (removing the asterix) - but not sure how to do 'Greater Than' etc - im no expert.

(Admitedly, though, you cant do where IF FIELD1=xxx and (Field2=yyy or Field3=zzz). So I too am still up for the ability to do so if it happens.
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

Post Reply