Step 1. At first edit the main.cf file of postfix.
# vim /etc/postfix/main.cf
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/protected_destinations, permit_mynetworks, reject_unauth_destination
smtpd_restriction_classes = insiders_only
insiders_only = check_sender_access hash:/etc/postfix/insiders, reject
[Explanation: smtpd_recipient_restrictions is a postfix parameter, It will check the recipient access by "protected_destinations"- Lets see below what I will put in "protected_destinations"? ]
Step 2. Edit and save the following in
# vim /etc/postfix/protected_destinations
xyz@domain.com insiders_only
[How do postfix knows insider_only?? It has been declared in main.cf with "smtpd_restriction_classes" after that I defined the "insiders_only" in postfix by "/etc/postfix/insiders".]
Step 3. Now input /etc/postfix/insiders
# /etc/postfix/insiders
domain.com OK ###matches my.domain and subdomains
anotherdomain.com OK ###matches another.domain and subdomains
Step 4. Now create .db for new files with following commands.
# postmap /etc/postfix/insiders
# postmap /etc/postfix/protected_destinations
Step 5.Restart the postfix service.
Now mentioned Mail ID cannot received any mail from mentioned Domain :)
0 Comments