[SOLVED]Help: Correct Filtering Script Syntax?

For any other discussion relating to MailEnable.
Post Reply
poweredge
Posts: 157
Joined: Sat May 29, 2021 11:16 am

[SOLVED]Help: Correct Filtering Script Syntax?

Post by poweredge »

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
Last edited by poweredge on Fri Jun 11, 2021 3:32 am, edited 1 time in total.

MailEnable-Ian
Site Admin
Posts: 9738
Joined: Mon Mar 22, 2004 4:44 am
Location: Melbourne, Victoria, Australia

Re: Help: Correct Filtering Script Syntax?

Post by MailEnable-Ian »

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
Regards,

Ian Margarone
MailEnable Support

poweredge
Posts: 157
Joined: Sat May 29, 2021 11:16 am

Re: Help: Correct Filtering Script Syntax?

Post by poweredge »

Many thanks Ian, it worked! :D

Indeed, missing a "*" in my original script. (Ie, *@domain.com.eu)

poweredge
Posts: 157
Joined: Sat May 29, 2021 11:16 am

Re: Help: Correct Filtering Script Syntax?

Post by poweredge »

MailEnable-Ian wrote:
Mon Jun 07, 2021 4:45 am
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
Btw, just one more question, I understood * as wildcard,

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.

Post Reply