Home > computers > mail > postfix > block mail from qq.com | About

Since you want to block from a particular sender's domain, you want the smtpd_sender_restriction configuration parameter. It takes many possibles values, you want the check_sender_access value.

smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/maps/reject_senders

What this does is say to postifx : whenever a sender (outside or inside) tries to send mail to a recipient (outside or inside), you should check if the sender has authorisation to do so by checking the file /etc/postfix/maps/reject_senders

That file should contain lines like this :

qq.com  REJECT   

This tells postfix that all mail coming from qq.com should be rejected.

For this to work, you need to make a database file out of the text file with the postmap command :

postmap /etc/postfix/maps/reject_senders

That command should generate a Bekrley DB database that postfix supports and knows how to use

root@messagerie[] ~ # ls /etc/postfix/maps/reject_senders.db 
-rw-r--r-- 1 root root 12K Dec  5 12:30 /etc/postfix/maps/reject_senders.db                                                                                                                                                                                                    
root@messagerie[] ~ # file /etc/postfix/maps/reject_senders.db                                                                                                                                                                                                    
/etc/postfix/maps/reject_senders.db: Berkeley DB (Hash, version 9, native byte-order)                                                                                                                                                                                          
root@messagerie[] ~ #       

Reload postfix with postfix reload and you should be seeing log messages like these :


contact : @ychaouche yacinechaouche at yahoocom

QR Code
QR Code postfixblockdomain (generated for current page)