To blacklist or reject an email address in Postfix, you can use the smtpd_sender_restrictions
parameter in the main.cf
configuration file. The smtpd_sender_restrictions
parameter specifies a list of restrictions that are applied to the sender of an email message.
Here's an example of how to use the smtpd_sender_restrictions
parameter to blacklist or reject an email address in Postfix:
smtpd_sender_restrictions = reject_sender_login_mismatch, reject_non_fqdn_sender, reject_unknown_sender_domain, check_sender_access hash:/etc/postfix/blacklist
This configuration will reject email messages from senders whose login name or domain does not match the envelope sender address, and will also check the sender against the blacklist file located at /etc/postfix/blacklist
.
To add an email address to the blacklist, you can add a line to the /etc/postfix/blacklist
file in the following format:
sender@example.com REJECT
This will reject all email messages from the sender@example.com
email address.
Once you have added the email address to the blacklist, you will need to run the postmap
command to update the Postfix database:
postmap /etc/postfix/blacklist
You will also need to reload the Postfix server to apply the changes:
systemctl reload postfix