How to configure postfix/dovecot setup to reject certain mail

by Axel Latvala   Last Updated April 15, 2019 11:00 AM

I followed this ( tutorial to set up my mailserver and it works very well.

I'd like to be able to reject email from certain users or if it contains certain strings or if the title matches something.

Is this possible?

I am using MySQL for users and am in a multidomain env.

Answers 2

You can use header_checks and body_checks to block on certain strings. More info here. You can use smtpd_sender_restrictions to block mails from certain users. More info here.

header_checks = regexp:/etc/postfix/
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/blacklisted_roles

/^Subject:(.*) offensive_word /     REJECT Inappropriate word

[email protected]    REJECT
March 02, 2014 11:28 AM

Thank you for the question and answer. I have similar problem to solve, but have to filter connection from mobile devices to my postfix/dovecot based on username and reject ones that are not in the list. Any ideas how to do it? Let me know.

April 15, 2019 10:37 AM

Related Questions

Fold burst of many emails into one?

Updated November 17, 2017 14:00 PM

Postfix capture messages exceeding limit

Updated December 26, 2015 11:00 AM