简体   繁体   中英

Postfix Blocking E-mail from address containing two @ symbols

My mail server has been receiving a lot of spam with malicious links and attachments lately which have "From" addresses that contain a valid address from my domain with an additional @someotherdomain.hn address appended.

For example: John Smith has an e-mail address of JohnSmith@mydomain.com I receive e-mail with a "from" address of JohnSmith@mydomain.com@someotherdomain.hn

I would like to know if it is possible to block e-mail if the "from" address contains more than one "@" symbol.

You tag as Regex so I assume you want a regex that matches addresses with 2 ' @ ' symbols.

Here it is:

/@.*@/

This will match any address with 2 (or more) @ -signs.

It simply starts with matching ' @ ', followed by zero or more characters, and finally another ' @ '.

All you have to do is delete the mail, if there's a match.

Edit :

To only match when one mail address has two ' @ ' signs, and not when there are two addresses (each with a single @), you can use this Regex (assuming addresses are separated by comma ' , '):

/@[^,]*@/

Again, if there's a match, delete it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM