我正在运行rhel 7.2 ,我已经安装了postfix ,无法通过gmail smtp服务器进行中继。 我跟着很多的教程,并search了很多其他post的答案,但我似乎无法得到任何工作。
这是我在/var/log/maillog的当前错误(为了保密,我用xreplace了主机名和电子邮件地址:
Jun 30 16:35:15 xxxxxxxx postfix/qmgr[31716]: 1DC08C13E1CA: from=<[email protected] >, size=277, nrcpt=1 (queue active) Jun 30 16:35:15 xxxxxxxx postfix/smtp[31846]: 1DC08C13E1CA: to=<[email protected]>, relay=smtp.gmail.com[173.194.193.109]:587, delay=3512, delays=3512/0.02/0.31/0.04, d sn=5.5.1, status=bounced (host smtp.gmail.com[173.194.193.109] said: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14 257 z205sm11773703itc.11 - gsmtp (in reply to MAIL FROM command)) Jun 30 16:35:15 inigo postfix/cleanup[31848]: 9544CC13E1CF: message-id=<2016063022351 5.9544CC13E1CF@inigo> Jun 30 16:35:15 xxxxxxxx postfix/bounce[31847]: 1DC08C13E1CA: sender non-delivery notifi cation: 9544CC13E1CF Jun 30 16:35:15 xxxxxxxx postfix/qmgr[31716]: 9544CC13E1CF: from=<>, size=2283, nrcpt=1 (queue active) Jun 30 16:35:15 inigo postfix/qmgr[31716]: 1DC08C13E1CA: removed Jun 30 16:35:15 inigo postfix/smtp[31846]: 9544CC13E1CF: to=<[email protected]>, relay=smtp.gmail.com[173.194.193.108]:587, delay=0.32, delays=0.01/0/0.28/0.03, dsn= 5.5.1, status=bounced (host smtp.gmail.com[173.194.193.108] said: 530-5.5.1 Authentic ation Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14257 p131sm3141384itg.17 - gsmtp (in reply to MAIL FROM command)) Jun 30 16:35:15 xxxxxxxxxx postfix/qmgr[31716]: 9544CC13E1CF: removed
我已经尝试了在线答案的多个解决scheme,这就是我的/etc/postfix/main.cf文件结果如下所示:
queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix mail_owner = postfix myhostname = xxxxxxxx myorigin = $myhostname inet_interfaces = 10.10.10.10,127.0.0.1 inet_protocols = ipv4 mydestination = $myhostname, localhost.$mydomain, localhost unknown_local_recipient_reject_code = 550 mynetworks = 127.0.0.0/8, 10.10.10.0/24 relayhost = [smtp.gmail.com]:587 alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases home_mailbox = Maildir/ smtpd_banner = $myhostname ESMTP debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/sbin/sendmail.postfix newaliases_path = /usr/bin/newaliases.postfix mailq_path = /usr/bin/mailq.postfix setgid_group = postdrop html_directory = no manpage_directory = /usr/share/man sample_directory = /usr/share/doc/postfix-2.10.1/samples readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES message_size_limit = 10485760 mailbox_size_limit = 1073741824 smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous smtp_sasl_local_domain = $myhostdomain smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject smtp_use_tls = yes smtp_tls_CAfile = /etc/postfix/cacert.pem smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd smtp_sasl_security_options = noanonymous smtp_sasl_tls_security_options = noanonymous smtp_tls_policy_maps = hash:/etc/postfix/tls_policy smtp_tls_security_level = secure smtp_tls_mandatory_protocols = TLSv1 smtp_tls_mandatory_ciphers = high smtp_tls_secure-cert_match = nexthop smtp_tls_CApath = /etc/ssl/certs smtpd_tls_CAfile = /etc/postfix/cacert.pem debug_peer=smtp.gmail.com debug_peer_level=3`
顺便说一下postfix是/etc/postfix/sasl/passwd文件的所有者
如果有人有任何build议,我将不胜感激!
检查你已经正确格式化了/etc/postfix/sasl/passwd 。
它应该显示为:
smtp.gmail.com [email protected]:password_or_app_password
设置这个文件后,你需要运行postmap来更新散列。
postmap /etc/postfix/sasl/passwd
然后重新加载postfix。
systemctl reload postfix
我有一些帮助,他们发现passwd文件没有像main.cf文件括号在smtp.gmail.com做的括号,所以我改变了这一点,并重新映射postmap,然后它给了我一个不同的错误,提到不值得机制可用,所以我做了一个谷歌search,发现别人有同样的错误,只是安装了cyrus-sasl-plain,并做了伎俩。 感谢所有的帮助。