Code: Select all
Dim FSO, fname
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fname = fso.OpenTextFile("C:\Test\MTA-log.txt", 8, True, 0)
fname.WriteLine "--- " & Now & " ---"
fname.WriteLine "ME_TOorCC = " & CStr([ME_TOorCC])
fname.WriteLine "ME_CC = " & [ME_CC]
fname.WriteLine "ME_TO = " & [ME_TO]
fname.WriteLine "ME_BODY = " & [ME_BODY]
fname.WriteLine "ME_IPADDRESS = " & [ME_IPADDRESS]
dim recipients
recipients = Split( Replace([ME_TO], ",", ";") , ";")
fname.WriteLine "UBOUND(recipients) = " & CStr(UBOUND(recipients))
For Each s in recipients
fname.WriteLine "Recipient [" & s & "]"
Next
For Each s in recipients
If CriteriaMet( s ,"*@mytest.local") Then
fname.WriteLine s & " matches *@mytest.local"
Else
fname.WriteLine s & " does not match *@mytest.local"
result = 1
Exit For
End If
Next
FilterResult = result
fname.close
fname = Nothing
FSO = Nothing
I am trying to build a filter that will allow users to send emails to only one domain. The tokens for [ME_TO], [ME_CC], and [ME_TOorCC] all allow messages through if there are multiple recipients and at least one is an allowed domain.--- 26/06/2018 15:27:17 ---
ME_TOorCC = 1
ME_CC = 0
ME_TO = 1
ME_BODY = 1
ME_IPADDRESS = 0
UBOUND(recipients) = 0
Recipient [0]
0 does not match *@mytest.local