local_only = check_recipient_access hash:/etc/postfix/local_domains,reject
local_only1 = check_sender_access hash:/etc/postfix/local_domains,reject
smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/local_senders,
check_recipient_access hash:/etc/postfix/local_recipients,
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unauth_destination,
reject_unauth_pipelining,
reject_rhsbl_sender,
reject_unknown_sender_domain,
reject_invalid_hostname
注1:從第5行開始前面空一格.
local_domains文件内容为:
domain.com OK
192.168.0.1 OK
local_senders文件内容为:
kently@domain.com local_only
local_recipients文件内容为:
kently@domain.com local_only1
postmap hash:/etc/postfix/local_senders
postmap hash:/etc/postfix/local_recipients
email=kently
#要修改Email,就只用修改这个变量值。
echo "$email@AA.com local_only" >> /etc/postfix/local_senders
echo "$email@AA.com local_only1" >> /etc/postfix/local_recipients
#创建文件
postmap hash:/etc/postfix/local_domains
postmap hash:/etc/postfix/local_senders
postmap hash:/etc/postfix/local_recipients
#postfix查询数据库
postfix reload
#加载配置
mv -f /etc/postfix/local_senders.new /etc/postfix/local_senders
sed 's/dd@aa/456/g' /etc/postfix/local_recipients > /etc/postfix/local_recipients.new
mv -f /etc/postfix/local_recipients.new /etc/postfix/local_recipients
postmap hash:/etc/postfix/local_domains
postmap hash:/etc/postfix/local_senders
postmap hash:/etc/postfix/local_recipients
postfix reload