我花了很长时间来处理main.cf
文件,但仍然找不到原因。我已经按照本教程设置了一个电子邮件服务器在 CentOS 7 上使用 Postfix、Dovecot 和 MariaDB 发送电子邮件
这是有关 postfix 的部分:
myhostname = server.example.com
mydestination = localhost, localhost.localdomain
mynetworks = 127.0.0.0/8
inet_interfaces = all
message_size_limit = 30720000
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
现在,在我的服务器中,我可以从[电子邮件保护]到[电子邮件保护],我可以收到来自[电子邮件保护],但我无法发送电子邮件至[电子邮件保护]。我收到错误:Relay access denied
。我应该更改什么吗?
编辑:
这是来自/var/log/maillog
NOQUEUE: reject: RCPT from unknown[(Server's IP)]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=SMTP
答案1
请注意以下部分main.cf
:
smtpd_recipient_restrictions = permit_mynetworks ...
因此 smtpd 仅允许来自的 IP 地址来mynetworks
中继电子邮件。
您需要做的是将您的 IP 添加到mynetworks
。例如,如果您的 IP 地址是 192.168.1.123,则将参数更改为
mynetworks = 127.0.0.0/8 192.168.1.123
然后你就可以成功发送电子邮件了。