Postfix Config Files
/etc/postfix/access
The access table controls which senders/recipients/hosts are permitted or rejected.
Format: pattern action
# Permit specific domains
example.com OK
.example.com OK
# Reject specific addresses
spammer@evil.com REJECT
@spammerdomain.com REJECT
# Reject with custom message
badguy@example.com 550 Blocked
# Permit local network
192.168.1 OK
10.0.0 OK
After editing, rebuild the hash map:
postmap /etc/postfix/access
postfix reload
/etc/postfix/main.cf Key Settings
# Basic identity
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = ipv4
# Relay configuration
mynetworks = 127.0.0.0/8, 192.168.1.0/24
mydestination = $myhostname, localhost.$mydomain, $mydomain
relayhost =
# Mailbox format
home_mailbox = Maildir/
mailbox_size_limit = 0
message_size_limit = 52428800
# Restrictions
smtpd_helo_required = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
check_sender_access hash:/etc/postfix/access,
reject_rbl_client zen.spamhaus.org,
reject_rbl_client bl.spamcop.net,
permit
/etc/postfix/virtual
Maps email addresses to local users:
# /etc/postfix/virtual
info@example.com localuser
admin@example.com localuser
@catchall.com localuser
postmap /etc/postfix/virtual
Add to main.cf:
virtual_alias_maps = hash:/etc/postfix/virtual