MailEnable Enterprise Guide
Message Filtering / Scripted Filtering / Overview / Enumerations requiring the CriteriaMet syntax
In This Topic
    Enumerations requiring the CriteriaMet syntax
    In This Topic

     CriteriaMet is an inbuilt function which is used to check whether an email message matches a criteria. The criteria available match the ones that you can create in the administration program under the standard filtering options. The CriteriaMet function returns true or false and has two parameters, Token and Value. The available Tokens are described in the table below alongside their allowed values.

    Token

    Value

    Notes

    [ME_TO]

    String with wildcards optional.

    The message envelope recipients or the To: denoted in the message headers matches the designated criteria.

    [ME_CC]

    String with wildcards optional.

    The Cc: denoted in the message headers matches the designated criteria.

    [ME_TOorCC]

    String with wildcards optional.

    The message envelope recipients or the To: or Cc: denoted in the message headers matches the designated criteria.

    [ME_FROM]

    String with wildcards optional.

    The message envelope sender or the From: denoted in the message headers matches the designated criteria.

    [ME_HEADERS_CONTAIN]

    String with wildcards optional.

    The message headers contain data matching the designated criteria.

    [ME_SUBJECT]

    String with wildcards optional.

    The message subject contains data matching the designated criteria.

    [ME_PRIORITY]

    The priority of the message. The values can be "Low", "Normal" or "High".

    The priority of the message.

    [ME_SPF]

    The SPF result, which can be "Fail", "Pass", "Soft Fail", "Error", "Neutral" or "None".

    The SPF response string associated with the message is checked. This corresponds to the "Received-SPF" header item.
    [ME_DKIM] Can be 0 for a failed DKIM check, 1 for a pass or 2 for indeterminate. The CriteriaMet function will return true if there is a match. The function will not return true if there is no DKIM header on the message. So if you wish to action on messages that do not have DKIM, as well as those that pass DKIM, then you should use "Not CriteriaMet([ME_DKIM],"0")" in your script, which indicates you are after those that do not have incorrect DKIM headers.

    [ME_HASATTACHMENTSMATCHING]

    File name pattern. This can be a filename, and wildcards can be used.

    The message contains an attachment with a file name that that matches the criteria. This can be used to block file extensions, as you can format the criteria as *.extension, for example you can use *.iso. 
    [ME_COUNTRY_MATCH] Two letter country code, such as "US" for United States. The file Mail Enable\Config\GeoIPData\countries.txt contain the available country codes.
    [ME_COUNTRY_NOMATCH] Two letter country code, such as "US" for United States. The file Mail Enable\Config\GeoIPData\countries.txt contain the available country codes.

    [ME_BODY]

    String with wildcards optional.

    The body of the message contains text meeting the designated criteria.
    [ME_SENDERAUTH] 1 For checking whether the sender authenticated in order to send the email.
    [ME_IPADDRESS_WHITELISTED] 1 For checking whether the originating IP address is whitelisted.
    [ME_SPAM_PROBABILITY] Number between 0 and 100. The message is tested using the Bayesian filter and will meet the criteria if the probability is higher than the specifed amount. For example, use 95 as the value and anything over 95 (not including 95) will trigger the action.

     

    Literal Enumeration Example
    Copy Code
    If (CriteriaMet([ME_SUBJECT], "Viagra")) Then
    'Do Stuff
    End If
    In cases where literal values return 1 or 0, it is possible to also use literal values with the CriteriaMet function, although there is no real reason to do so:
    Example: CriteriaMet([ME_SENDERAUTH], 0) is the same as ([ME_SENDERAUTH] = 0)
    But this is not the case for string values:
    CriteriaMet([ME_SUBJECT], "Viagra") is not the same as ([ME_SUBJECT] = "Viagra") because string tokens cannot be used in this manner.