I'd like to set one line of spam blacklist rule in Email server, blocking email addresses containing any capital letters with the Email account name. How should I set it?

Rule file content for example:

From:        *@friendly.com   yes     (all "friendly.com" domain email address.)
From:        /^192\.168\.13[4567]\./ yes (represent 192.168.13~17

The following Email addresses with any capital letters Email account names need to be blocked:

...on so forth

Thanks for any advice.

  • Which "Email" server? Which distribution? Oct 12 '16 at 14:12
  • Beware that the vast majority of mail servers treat the entire email address as case-insensitive. Oct 12 '16 at 14:14
  • Use MailScanner on Mailgate server. Rule can be treat the entire email address as case-sensitive?
    – Danny Luk
    Oct 12 '16 at 14:22
  • Consider this scenario: John Doe sends a message to a mailing list with the address JohnDoe@example.com, and the mailing list's server re-sends it to you with the address johndoe@example.com. But to play by your rules: you'll have to clarify what SMTP server you're using, whether you want to filter envelope addresses or header addresses, relayed messages or local posts etc. "Can do X" is not the same as "it makes sense to do X". Oct 12 '16 at 14:23

I don't know about your particular e-mail server, but to search for any capital letter in a string, you can use a regular expression such as [A-Z]. Given your example, and here using grep (the switch -o is used to only print the matches from the expression):

echo "TommySoseboo@linux.com" | grep -o '[A-Z]'

...you can see that this expression matches only the T and the S in the name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.