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

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

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

Postby GlooM » Thu Sep 09, 2021 6:50 am

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: 15
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?

Postby porokh » Fri Sep 10, 2021 11:20 am

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: 61
Joined: Wed Jun 28, 2017 9:40 am

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

Postby simred » Fri Sep 10, 2021 4:10 pm

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: 113
Joined: Sat Sep 13, 2014 12:50 am

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

Postby GlooM » Sat Sep 11, 2021 2:09 pm

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: 15
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?

Postby porokh » Mon Sep 13, 2021 7:54 am

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: 15
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?

Postby porokh » Mon Sep 13, 2021 8:04 am

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: 129
Joined: Tue Jun 17, 2014 3:31 am
Contact:

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

Postby barrydegraaff » Tue Sep 14, 2021 5:43 am

--
Barry de Graaff
Admin of Zimbra-Community Github: https://github.com/orgs/Zimbra-Community/
Developer of Zimbra OpenPGP Zimlet, Zimbra ownCloud Zimlet and more.
A Zetalliance Founder http://www.zetalliance.org/

Return to “Administrators”

Who is online

Users browsing this forum: No registered users and 29 guests