后缀:中继访问被拒绝。 如何解决它?

我一直摆弄main.cf文件很长一段时间,但仍然无法find原因。 我已经build立了一个电子邮件服务器与这个教程电子邮件与Postfix,Dovecot和MariaDB在CentOS 7

这是关于后缀的部分:

 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 

现在在我的服务器中,我可以将user1@example.com的电子邮件发送到user2@example.com,我可以收到来自user@gmail.com的电子邮件,但是我不能发送邮件到user@gmail.com。 我得到一个错误: Relay access denied 。 有什么我应该改变?


编辑:

这是来自/var/log/maillog

 NOQUEUE: reject: RCPT from unknown[(Server's IP)]: 454 4.7.1 <user@gmail.com>: Relay access denied; from=<user1@example.com> to=<user@gmail.com> proto=SMTP 

main.cf注意这个部分:

 smtpd_recipient_restrictions = permit_mynetworks ... 

所以smtpd只允许来自mynetworksnetworking的IP地址转发电子邮件。

你需要做的是将你的IP添加到我的mynetworks 。 例如,如果您的IP地址是192.168.1.123,请将参数更改为

 mynetworks = 127.0.0.0/8 192.168.1.123 

然后您可以成功发送电子邮件。