cPanel & WHM Version 114 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Global Email Filters - Body.Contains.String Bug

omidsolo shared this idea 4 years ago
Open Discussion

As a cPanel User, I would like to be able to create custom global filters that will work for both HTML and plain text emails so that I can automatically filter out messages in foreign languages to eliminate spam.

For example: change the If condition in filtering FROM

If varMsgBody.Contains(“?”) = True Then


If varMsgBody.Contains(“?”) = True Or varMsgBody.Contains(Uri.EscapeUriString(“?”)) = True Then


I Created 2 global filters: Russian & Chinese

In each filter, I enter the most used chars in each language and set if Body contains any of them, fail with a message!

For Russian, I enter both lower & upper case in separate fields.

But they will NOT work in HTML emails!

You can fill the UTF-8 email body with all of the blocked characters but it's not filtered and received!

cPanel 78.0.21. Site owner, no root access.

Your filter system is simply like this:

varMsgBody is the variable holding the whole email message body

? is the Russian character I entered in the filter list (along with some others)

If varMsgBody.Contains("?") = True Then

'Fail with message

End If

While you should also:

If varMsgBody.Contains("?") = True Or varMsgBody.Contains(Uri.EscapeUriString("?")) = True Then

'Fail with message

End If

Because in the inner message source ? is converted to =D0=99 so you should check both for the entered character and it's HTML encoded form so your code logic works in all conditions with all characters.

*** Please note that Uri.EscapeUriString("?") in .NET converts ? to =D0=99Unfortunately I don't know the equivalent in Perl

Full thread ( from Forum to Support, from Support to Features, next location?! :D )

Leave a Comment
Attach a file