尝试使用Postfix将电子邮件中继到Gmail时,“找不到有价值的机制”


28

我一直在尝试配置电子邮件以转发到Gmail,使用Postfix将电子邮件中继到smtp.gmail.com。但是,我无法通过smtp.gmail.com对其进行身份验证,这是使一切正常运行的相当重要的先决条件……

邮件日志仅显示:

Oct 29 15:50:14 gsnedders-1 postfix/master[6596]: daemon started -- version 2.7.1, configuration /etc/postfix
Oct 29 15:50:19 gsnedders-1 postfix/pickup[6598]: EBA1F78750: uid=1000 from=<gsnedders>
Oct 29 15:50:19 gsnedders-1 postfix/cleanup[6603]: EBA1F78750: message-id=<20111029145019.EBA1F78750@mail.gsnedders.com>
Oct 29 15:50:19 gsnedders-1 postfix/qmgr[6599]: EBA1F78750: from=<gsnedders@gsnedders.com>, size=324, nrcpt=1 (queue active)
Oct 29 15:50:19 gsnedders-1 postfix/cleanup[6603]: F2D557874F: message-id=<20111029145019.EBA1F78750@mail.gsnedders.com>
Oct 29 15:50:19 gsnedders-1 postfix/local[6605]: EBA1F78750: to=<me@gsnedders.com>, orig_to=<me>, relay=local, delay=0.04, delays=0.03/0.02/0/0, dsn=2.0.0, status=sent (forwarded as F2D557874F)
Oct 29 15:50:19 gsnedders-1 postfix/qmgr[6599]: F2D557874F: from=<gsnedders@gsnedders.com>, size=454, nrcpt=1 (queue active)
Oct 29 15:50:19 gsnedders-1 postfix/qmgr[6599]: EBA1F78750: removed
Oct 29 15:50:20 gsnedders-1 postfix/smtp[6606]: warning: SASL authentication failure: No worthy mechs found
Oct 29 15:50:20 gsnedders-1 postfix/smtp[6606]: F2D557874F: SASL authentication failed; cannot authenticate to server smtp.gmail.com[74.125.157.108]: no mechanism available

后缀配置为:

relayhost = [smtp.gmail.com]:587

smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
smtp_sasl_security_options = noanonymous

smtp_tls_eccert_file =
smtp_tls_eckey_file =
smtp_tls_security_level = may
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_received_header = yes
tls_random_source = dev:/dev/urandom
smtpd_tls_security_level = may

首先在中修改以下行/etc/postfix/master.cfsmtp unix - - y - - smtp -v,这样您就可以在日志中获取更多详细信息。
Jaime Hablutzel

Answers:



23

跑步

sudo yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain

帮助我在Amazon AWS服务器上。


在Fedora 27上的Postfix(当然必须用dnf替换yum)上也有帮助-以及其他在TL​​S上进行普通身份验证的SMTP中继。仅仅安装postfix不会插入cyrus-sasl-plain软件包...(这是从Fedora 26更改的)。
maxschlepzig

谢谢!这解决了我的问题。
Jayman8543

1

sudo yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain

通过Gmail中继设置(CentOS 7)为我工作


1

我遇到了这个问题(tail -f /var/log/mailog):

to=<usmanali@example.com>, relay=smtp.sendgrid.net[169.45.113.201]:587, delay=0.3, delays=0.05/0.07/0.16/0.02, dsn=5.0.0, status=bounced (host smtp.sendgrid.net[169.45.113.201] said: 550 Unauthenticated senders not allowed (in reply to MAIL FROM command))

然后我/etc/postfix/main.cf以这种方式更改文件,将以下行添加到文件末尾

mtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_size_limit = 256000000

# Sendgrid Settings
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:apikey:SG.YOUR_SENDGRID_KEY
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587

然后使用以下命令安装缺少组件的后缀:

sudo yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain

然后重新启动后缀

sudo systemctl restart  postfix.service

最终它可以在centos 7上运行

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.