zimbra规则:只能发送邮件到指定域名

需求:sender.allowed.com内的用户只能发送邮件给sender.allowed.com与another.allowed.com内的用户

实现方式:使用postfix规则来实现该功能。

完成效果:sender.allowed.com下的用户发送邮件到指定域名之外的邮箱时,会提示
At least one address is not valid.
Invalid addresses: [email protected]

Postfix generates this error message on rcpt to (clearly we are not propogating the exact error up, but not a big deal):
Sender address rejected: Access denied

先添加一个发件人限制规则,然后限制收件人只能是指定列表中的。这些限制是全局的,对每个MTA邮箱都有效。

1、首先生成一个发件人列表,列出允许发出邮件的域名:
cd /opt/zimbra/conf
echo "sender.allowed.com restrict_tpmail" > tpmail_senders
postmap tpmail_senders

2、生成一个收件人列表:
cd /opt/zimbra/conf
echo "another.allowed.com OK" > tpmail_recipients
echo "sender.allowed.com OK" >> tpmail_recipients
postmap tpmail_recipients

3、生成两个配置文件
cd /opt/zimbra/conf
echo "check_sender_access hash:/opt/zimbra/conf/tpmail_senders" > postfix_sender_restrictions.cf
echo "check_recipient_access hash:/opt/zimbra/conf/tpmail_recipients, reject" >> postfix_restrict_tpmail.cf

4、编辑zmmta.cf文件,在
POSTCONF virtual_transport    LOCAL    postfix_virtual_transport

后面添加
POSTCONF smtpd_sender_restrictions    FILE    postfix_sender_restrictions.cf 
POSTCONF smtpd_restriction_classes            restrict_tpmail
POSTCONF restrict_tpmail              FILE    postfix_restrict_tpmail.cf

postfix reload

done

你可能感兴趣的:(zimbra规则:只能发送邮件到指定域名)