在postfix使用qq企业邮箱的smtp

在/etc/postfix/main.cf中添加如下信息

smtpd_tls_cert_file=/etc/ssl/certs/your.crt
smtpd_tls_key_file=/etc/ssl/private/your.key
smtpd_tls_CAfile=/etc/ssl/certs/your-chaint.crt

smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

relayhost = [smtp.exmail.qq.com]:587
smtp_sasl_auth_enable = yes
smtpd_tls_auth_only = no
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
#smtp_generic_maps = hash:/etc/postfix/generic


在/etc/postfix/创建文件sasl_passwd,填写如下内容

[smtp.exmail.qq.com]:587 EMAIL-ADDRESS:PASSWORD

然后通过如下命令生成hash库

postmap /etc/postfix/sasl_passwd

重启postfix

service postfix restart

测试一下

echo 'Hello Test' | mail -s "a new subject" USER@YOURCOMPANY.COM -a "Content-Type: text/plain; charset=UTF-8" -aFrom:noreply@YOURCOMPANY.COM



在配置过程中,有一个问题是

Oct 17 13:24:17 iZ23i21c87bZ postfix/smtp[11462]: DA1F842BA1: to=<xxx@yyy.com>, relay=smtp.exmail.qq.com[163.177.90.125]:587, delay=4
66, delays=466/0.01/0.29/0, dsn=4.0.0, status=deferred (SASL authentication failed; server smtp.exmail.qq.com[163.177.90.125] said: 530 Must is
sue a STARTTLS command first.)

这个原因可能是如下原因的一个。在main.cf里面添加了如下的实现了。也就是说不仅需要在main.cf里面追加key和cert,还需要追加chain cert

smtpd_tls_auth_only = no
<pre name="code" class="html">smtpd_tls_CAfile=/etc/ssl/certs/your-chaint.crt



展开阅读全文

没有更多推荐了,返回首页