I am trying to get the filter working by using Script as the default template doesn't have such function.
Basically I would like to capture all Incoming/Outgoing email for domain.com only BUT NOT domain.com.eu, thanks.
I've tried the following, and email to domain.com.eu was still captured somehow.
# If Header contains domain.com AND DOES NOT contain domain.com.eu, then capture such email
IF CriteriaMet([ME_TOorCC],"*@domain.com") AND NOT CriteriaMet([ME_TOorCC],"@domain.com.eu") OR CriteriaMet([ME_FROM],"*@domain.com") AND NOT CriteriaMet([ME_FROM],"@domain.com.eu") THEN
FilterResult=1
END IF
[SOLVED]Help: Correct Filtering Script Syntax?
[SOLVED]Help: Correct Filtering Script Syntax?
Last edited by poweredge on Fri Jun 11, 2021 3:32 am, edited 1 time in total.
-
- Site Admin
- Posts: 9738
- Joined: Mon Mar 22, 2004 4:44 am
- Location: Melbourne, Victoria, Australia
Re: Help: Correct Filtering Script Syntax?
Hi,
Try embracing the criteria values with cards.
I.e;
IF CriteriaMet([ME_TOorCC],"*@domain.com*") AND NOT CriteriaMet([ME_TOorCC],"*@domain.com.eu*") OR CriteriaMet([ME_FROM],"*@domain.com*") AND NOT CriteriaMet([ME_FROM],"*@domain.com.eu*") THEN
FilterResult=1
END IF
Try embracing the criteria values with cards.
I.e;
IF CriteriaMet([ME_TOorCC],"*@domain.com*") AND NOT CriteriaMet([ME_TOorCC],"*@domain.com.eu*") OR CriteriaMet([ME_FROM],"*@domain.com*") AND NOT CriteriaMet([ME_FROM],"*@domain.com.eu*") THEN
FilterResult=1
END IF
Regards,
Ian Margarone
MailEnable Support
Ian Margarone
MailEnable Support
Re: Help: Correct Filtering Script Syntax?
Many thanks Ian, it worked!
Indeed, missing a "*" in my original script. (Ie, *@domain.com.eu)
Indeed, missing a "*" in my original script. (Ie, *@domain.com.eu)
Re: Help: Correct Filtering Script Syntax?
Btw, just one more question, I understood * as wildcard,MailEnable-Ian wrote: ↑Mon Jun 07, 2021 4:45 amHi,
Try embracing the criteria values with cards.
I.e;
IF CriteriaMet([ME_TOorCC],"*@domain.com*") AND NOT CriteriaMet([ME_TOorCC],"*@domain.com.eu*") OR CriteriaMet([ME_FROM],"*@domain.com*") AND NOT CriteriaMet([ME_FROM],"*@domain.com.eu*") THEN
FilterResult=1
END IF
Isn't *@domain.com should be enough? Meaning any username@domain.com
Why do we still need the * at the end? (ie, *@domain.com*), * at the end will include any domain extension, such as domain.com.uk, domain.com.eu...?
Thanks.