Zimbra reject email by subject
Getting a lot of email spam which has similar subject lines? You can reject it before it gets put into a mailbox
As zimbra execute
zmprov gs `zmhostname` zimbraMtaHeaderChecks
You should see:
zimbraMtaHeaderChecks: pcre:/opt/zimbra/conf/postfix_header_checks
We need to add a new header checks file because the one named postfix_header_checks will be updated with the next version, to do that execute the following
zmprov ms `zmhostname` zimbraMtaHeaderChecks 'pcre:/opt/zimbra/conf/postfix_header_checks pcre:/opt/zimbra/conf/custom_header_checks' zmmtactl restart
Now, “Show Original” on the email that you want to block – and copy the “Subject: ” line
Edit /opt/zimbra/conf/custom_header_checks
Inset/add the following two lines
/Subject: This is crappy spam/ REJECT I dont want your spam
The first line is the subject line you copied using “Show Original” (If you are receiving multiple emails that have similar subject lines, you can modify this line using regular expressions)
The second line – REJECT causes Zimbra to reject the email- “I dont want your spam” is a message relayed to the sender.
If you have a multi-server zimbra system -you have to do all of the above to each server that receives email
Tested on Zimbra 8.8
Ref: https://wiki.zimbra.com/wiki/King0770-Notes-Header-Checks#Section_VI_-_ZCS_8.5.2C_8.6.2C_8.7.2C_8.8