scripted filter ME_HEADERS_CONTAIN not working for Deliver-To=Junk

Discussion forum for Enterprise Edition.
Post Reply
delta2
Posts: 42
Joined: Mon Dec 20, 2004 7:25 am

scripted filter ME_HEADERS_CONTAIN not working for Deliver-To=Junk

Post by delta2 » Thu Mar 10, 2016 12:17 pm

I run several filters which "Mark message as SPAM".

The work as expected and resulting messages have the spam header added:

X-ME-Content: Deliver-To=Junk

After all these filters I have a scripted filter which copies to the Quarantine Folder all messages with attachments that haven't been marked as SPAM.
This is so I can check the MTA log to see if any zipped executables are getting through.

Code: Select all

FilterResult=0
If ([ME_SENDERAUTH] = 0) Then
  If ([ME_HASANATTACHMENT] = 1) Then
    If NOT CriteriaMet([ME_HEADERS_CONTAIN],"*X-ME-Content: Deliver-To=Junk*") Then
      FilterResult=1
      x = CriteriaMet([ME_HEADERS_CONTAIN],"*X-ME-Content: Deliver-To=Junk*")
      MEResultData = "UnJunked ZIP. Check quarantined copy. (%SUBJECT%)(" & x & ")"
    End If
  End If
End If
The CriteriaMet([ME_HEADERS_CONTAIN],"*X-ME-Content: Deliver-To=Junk*") always returns False even if the resulting message has been marked with X-ME-Content: Deliver-To=Junk

03/10/16 12:18:05 Executed D2B191AA1D944307B2FEE4B59B3058B0.MAI SMTP ZIP Attachments NOT Junked (see Quarantine) COPY_TO_QUARANTINE [SMTP:scanner@xxxxxx.com] 122.53.180.66 UnJunked ZIP. Check quarantined copy. (Attached Image)(False) Attached Image

Any idea why ?

Thanks. Stuart.
Stuart

delta2
Posts: 42
Joined: Mon Dec 20, 2004 7:25 am

Re: scripted filter ME_HEADERS_CONTAIN not working for Deliver-To=Junk

Post by delta2 » Thu Mar 10, 2016 5:40 pm

I solved the issue by applying the "Stop processing filters" action to the "Mark message as SPAM" filters.

I assume that the CriteriaMet([ME_HEADERS_CONTAIN] ... check is only for headers that exist when the email is read initially before processing the filters and that any Headers added by any of the filters are only added once all filters have be executed.

If anyone from MailEnable is reading then maybe they can confirm this !

Ciao. Stuart.
Stuart

aahq
Posts: 183
Joined: Sat Aug 07, 2010 11:08 am

Re: scripted filter ME_HEADERS_CONTAIN not working for Deliver-To=Junk

Post by aahq » Mon Mar 14, 2016 9:36 am

Not sure but have you tried removing the "" around ----> "*X-ME-Content: Deliver-To=Junk*

It may be looking for something that has a literal * in it?

Scott

delta2
Posts: 42
Joined: Mon Dec 20, 2004 7:25 am

Re: scripted filter ME_HEADERS_CONTAIN not working for Deliver-To=Junk

Post by delta2 » Mon Mar 14, 2016 10:12 am

@scott

The quotes are necessary. Please see the documentation.
http://www.mailenable.com/documentation ... ample.html

************************************************
The problem is resolved.

As stated ME most likely adds headers after all the filters have been executed so any headers added by filters will NOT be picked up by subsequent filters.

I only asked for confirmation of this from the ME developers.

************************************************


Ciao. Stuart
Stuart

Post Reply