主题: 在项目中无法使用iredmail邮件服务器来发送邮件

==== 必填信息。没有填写将不予回复 ====
- iRedMail 版本号:0.9.5
- 使用哪个数据库存储用户帐号(OpenLDAP,MySQL,PostgreSQL):mysql
- 使用的 Linux/BSD 发行版名称及版本号:ubuntu14.04
- 与您的问题相关的日志信息:
==== 邮件搭好后可以在foxmail配置成功,不过smtp端口要设为587,可以实现邮件的发送,但是当我在项目中使用改服务器时出错。
项目中的邮件服务器配置代码(CI框架):
        $config['protocol'] = 'smtp';
        $config['smtp_host'] = "mail.moceancloud.com";
        $config['smtp_port'] = 587;
        $config['smtp_user'] = "zhaowei";
        $config['smtp_pass'] = "";
        $config['wordwrap'] = TRUE;
        $config['mailtype'] = "html";
提示错误信息:
220 mail.moceancloud.com ESMTP Postfix
hello: 250-mail.moceancloud.com
250-PIPELINING
250-SIZE 15728640
250-ETRN\r\n250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first
from: 530 5.7.0 Must issue a STARTTLS command first
The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first
to: The following SMTP error was encountered:
Unable to send data: DATA
=======
mail.log日志:
Oct 20 09:37:00 mail postfix/submission/smtpd[40793]: connect from unknown[112.91.80.106]
Oct 20 09:37:00 mail postfix/submission/smtpd[40793]: lost connection after UNKNOWN from unknown[112.91.80.106]
Oct 20 09:37:00 mail postfix/submission/smtpd[40793]: disconnect from unknown[112.91.80.106]
Oct 20 09:40:20 mail postfix/anvil[40795]: statistics: max connection rate 1/60s for (submission:112.91.80.106) at Oct 20 09:37:00
Oct 20 09:40:20 mail postfix/anvil[40795]: statistics: max connection count 1 for (submission:112.91.80.106) at Oct 20 09:37:00
Oct 20 09:40:20 mail postfix/anvil[40795]: statistics: max cache size 1 at Oct 20 09:37:00
Oct 20 09:44:40 mail postfix/submission/smtpd[40915]: connect from unknown[112.91.80.106]
Oct 20 09:44:40 mail postfix/submission/smtpd[40915]: lost connection after UNKNOWN from unknown[112.91.80.106]
Oct 20 09:44:40 mail postfix/submission/smtpd[40915]: disconnect from unknown[112.91.80.106]
Oct 20 09:48:00 mail postfix/anvil[40917]: statistics: max connection rate 1/60s for (submission:112.91.80.106) at Oct 20 09:44:40
Oct 20 09:48:00 mail postfix/anvil[40917]: statistics: max connection count 1 for (submission:112.91.80.106) at Oct 20 09:44:40
Oct 20 09:48:00 mail postfix/anvil[40917]: statistics: max cache size 1 at Oct 20 09:44:40

回复: 在项目中无法使用iredmail邮件服务器来发送邮件

该问题已经解决,修改 /etc/postfix/master.cf

增加
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
更改
-o smtpd_tls_security_level=encrypt

-o smtpd_tls_security_level=may

回复: 在项目中无法使用iredmail邮件服务器来发送邮件

你应该让自己的程序使用 starttls 加密连接,而不是在服务器上将强制加密连接(encrypt)改为可选加密连接(may)。这是开倒车。。。