Our features site is undergoing a refresh! Be sure to explore the revamped site and discover our latest product roadmap launching here on Monday, March 18th.

Global Email Filters - Body.Contains.String Bug

omidsolo shared this idea 5 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

TO


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 )

https://forums.cpanel.net/threads/global-email-filters-body-bug.651997/

Leave a Comment
 
Attach a file