How can I block an email by the sender's name?

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
GlooM
Advanced member
Advanced member
Posts: 127
Joined: Sat Sep 13, 2014 12:50 am

How can I block an email by the sender's name?

Post by GlooM »

Hello!

I want to block the delivery of emails from any addresses by the sender's name.
For example:
"Webmaster" <name1@mail1.com>;
"Webmaster" <name2@mail2.com>;
"Webmaster" <name3@mail3.com>;

That is, regardless of the sender's mailbox address, the sender's name "webmaster" should be blocked.

As I understand it, there is no configurable spam filter for the domain in Zimbra. There is only the possibility to configure the filter directly in the users ' mailboxes. Apparently, this problem will have to be solved through configuring SpamAssasin. Tell me how to write a SA rule (in which file, the syntax of the rule, preferably with an example).
User avatar
porokh
Posts: 17
Joined: Tue May 14, 2019 10:02 am
Location: Ukraine
ZCS/ZD Version: 8.8.15 RHEL7 FOSS

Re: How can I block an email by the sender's name?

Post by porokh »

Hello!

If you really want to block incoming emails by sender's name, maybe the better way to do this is a Postfix Header Checks? Something like this:

Code: Select all

echo "/^From:.*Webmaster.*/ DISCARD" >>/opt/zimbra/conf/postfix_header_custom
zmprov mcf zimbraMtaHeaderChecks 'pcre:/opt/zimbra/conf/postfix_header_checks pcre:/opt/zimbra/conf/postfix_header_custom'
zmmtactl restart
Messages will be discarded during SMTP stage (i.e. without actual receiving a tons of garbage).
simred
Advanced member
Advanced member
Posts: 63
Joined: Wed Jun 28, 2017 9:40 am

Re: How can I block an email by the sender's name?

Post by simred »

Hello porokh,
does it works also for outgoing email filtering? I need to discard outgoing emails based on "Reply-to:" email header.

Tnx & br
porokh wrote:Hello!

If you really want to block incoming emails by sender's name, maybe the better way to do this is a Postfix Header Checks? Something like this:

Code: Select all

echo "/^From:.*Webmaster.*/ DISCARD" >>/opt/zimbra/conf/postfix_header_custom
zmprov mcf zimbraMtaHeaderChecks 'pcre:/opt/zimbra/conf/postfix_header_checks pcre:/opt/zimbra/conf/postfix_header_custom'
zmmtactl restart
Messages will be discarded during SMTP stage (i.e. without actual receiving a tons of garbage).
GlooM
Advanced member
Advanced member
Posts: 127
Joined: Sat Sep 13, 2014 12:50 am

Re: How can I block an email by the sender's name?

Post by GlooM »

porokh wrote:Hello!

If you really want to block incoming emails by sender's name, maybe the better way to do this is a Postfix Header Checks? Something like this:

Code: Select all

echo "/^From:.*Webmaster.*/ DISCARD" >>/opt/zimbra/conf/postfix_header_custom
zmprov mcf zimbraMtaHeaderChecks 'pcre:/opt/zimbra/conf/postfix_header_checks pcre:/opt/zimbra/conf/postfix_header_custom'
zmmtactl restart
Messages will be discarded during SMTP stage (i.e. without actual receiving a tons of garbage).
Hi Porokh!

Thank you very much! In fact, I don't care what kind of tool to implement the blocking. The fact of blocking is important to me. Postfix Header Checks are absolutely fine for me. Tell me, will your example ("/^From:.*Webmaster.*/ DISCARD") work for a different word format? For example, Webmaster, webmaster, WEBMASTER?
User avatar
porokh
Posts: 17
Joined: Tue May 14, 2019 10:02 am
Location: Ukraine
ZCS/ZD Version: 8.8.15 RHEL7 FOSS

Re: How can I block an email by the sender's name?

Post by porokh »

simred wrote:Hello porokh,
does it works also for outgoing email filtering? I need to discard outgoing emails based on "Reply-to:" email header.
Hello, simred!

Yes, postfix header checks works for outgoing messages too; I use it for hiding my internal IP, like this:

Code: Select all

/^Received: .*192\.168\.\123\.\d+\.*/ IGNORE
User avatar
porokh
Posts: 17
Joined: Tue May 14, 2019 10:02 am
Location: Ukraine
ZCS/ZD Version: 8.8.15 RHEL7 FOSS

Re: How can I block an email by the sender's name?

Post by porokh »

GlooM wrote:Thank you very much! In fact, I don't care what kind of tool to implement the blocking. The fact of blocking is important to me. Postfix Header Checks are absolutely fine for me. Tell me, will your example ("/^From:.*Webmaster.*/ DISCARD") work for a different word format? For example, Webmaster, webmaster, WEBMASTER?
Hello, GlooM!

As stated in header_checks man (http://www.postfix.org/header_checks.5.html): "By default, regexp: and pcre: patterns are case insensitive." so any case combinations will be matched.
User avatar
barrydegraaff
Zimbra Employee
Zimbra Employee
Posts: 242
Joined: Tue Jun 17, 2014 3:31 am
Contact:

Re: How can I block an email by the sender's name?

Post by barrydegraaff »

--
Barry de Graaff
Email: barry.degraaff [at] synacor [dot] com
Admin of Zimbra-Community Github: https://github.com/orgs/Zimbra-Community/ and the
Zimlet Gallery https://gallery.zetalliance.org/extend/
Post Reply