如何使用 godaddy office 365 电子邮件和数字海洋水滴发送电子邮件?
How can I send emails using godaddys office 365 email and digital ocean droplet?
我需要我们的应用服务器通过托管在 goddady 上的邮件服务器向我们的客户发送电子邮件
中描述的案例
我们添加了MX记录但是邮寄不起作用;我们用我们使用的库附上报告错误:
技术数据
- OS: ubuntu 16.07
- 语言:PHP7.2
- 邮件库:phpmailer 6.0.5
PHP 邮件配置
$mail->SMTPDebug = 4;
$mail->isSMTP();
$mail->Host = 'smtp.office365.net';
$mail->SMTPAuth = true;
$mail->Username = MAIL_APP1;
$mail->Password = MAIL_APP1_PWD;
$mail->SMTPSecure = 'ssl';
$mail->Port = 993; //SMTP_PORT;
报告的错误
2018-09-14 16:21:51 SERVER - & gt; CLIENT: * OK The Microsoft Exchange IMAP4 service is ready.
[QwBPADIAUABSADAANgBDAEEAMAAwADUANQAuAG4AYQBtAHAAcgBkADAANgAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A] * BYE Connection is closed. 13
2018-09-14 16:21:51 SMTP NOTICE: EOF caught while checking if connected
SMTP Error: Could not authenticate.
SMTP Error: Could not authenticate.
实现
新配置:
$mail->SMTPDebug = 4;
$mail->isSMTP();
$mail->DKIM_domain = '127.0.0.1';
$mail->Host = 'smtpout.secureserver.net';
$mail->SMTPAuth = true;
$mail->Username = MAIL_APP1;
$mail->Password = MAIL_APP1_PWD;
$mail->SMTPSecure = 'ssl';
$mail->Port = 465; //SMTP_PORT;
新错误:
2018-09-20 01:34:47 Connection: opening to ssl://smtpout.secureserver.net:465, timeout=300, options=array()<br>
2018-09-20 01:34:47 Connection: opened<br>
2018-09-20 01:34:47 SMTP INBOUND: "220 p3plsmtpa12-05.prod.phx3.secureserver.net :SMTPAUTH: ESMTP"<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 220 p3plsmtpa12-05.prod.phx3.secureserver.net :SMTPAUTH: ESMTP<br>
2018-09-20 01:34:47 CLIENT -> SERVER: EHLO app.persaerp.com<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-p3plsmtpa12-05.prod.phx3.secureserver.net hello [167.99.172.180], secureserver.net"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-HELP"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-AUTH LOGIN PLAIN"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-SIZE 30000000"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-PIPELINING"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-8BITMIME"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250 OK"<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 250-p3plsmtpa12-05.prod.phx3.secureserver.net hello [167.99.172.180], secureserver.net250-HELP250-AUTH LOGIN PLAIN250-SIZE 30000000250-PIPELINING250-8BITMIME250 OK<br>
2018-09-20 01:34:47 Auth method requested: UNSPECIFIED<br>
2018-09-20 01:34:47 Auth methods available on the server: LOGIN,PLAIN<br>
2018-09-20 01:34:47 Requested auth method not available: <br>
2018-09-20 01:34:47 Auth method selected: LOGIN<br>
2018-09-20 01:34:47 CLIENT -> SERVER: AUTH LOGIN<br>
2018-09-20 01:34:47 SMTP INBOUND: "334 VXNlcm5hbWU6"<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 334 VXNlcm5hbWU6<br>
2018-09-20 01:34:47 CLIENT -> SERVER: aW5mb0BwZXJzYWVycC5jb20=<br>
2018-09-20 01:34:47 SMTP INBOUND: "334 UGFzc3dvcmQ6"<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 334 UGFzc3dvcmQ6<br>
2018-09-20 01:34:47 CLIENT -> SERVER: UGVyJGFFUlAyMDE4<br>
2018-09-20 01:34:47 SMTP INBOUND: "535 Authentication Failed for info@persaerp.com. User does not have any relays assigned."<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 535 Authentication Failed for info@persaerp.com. User does not have any relays assigned.<br>
2018-09-20 01:34:47 SMTP ERROR: Password command failed: 535 Authentication Failed for info@persaerp.com. User does not have any relays assigned.<br>
SMTP Error: Could not authenticate.<br>
2018-09-20 01:34:47 CLIENT -> SERVER: QUIT<br>
2018-09-20 01:34:47 SERVER -> CLIENT: <br>
2018-09-20 01:34:47 SMTP ERROR: QUIT command failed: <br>
2018-09-20 01:34:47 Connection: closed<br>
SMTP Error: Could not authenticate.<br>
该错误消息中有一个赠品:The Microsoft Exchange IMAP4 service
- 您不应该在 SMTP 连接上看到有关 IMAP 的消息,事实上,您正在连接到端口 993,即 IMAP。您应该使用端口 465 或 587,但是...
如 PHPMailer 文档所述,GoDaddy 默认阻止出站 SMTP,并强制您通过他们自己的邮件服务器进行中继。这打破了许多电子邮件要求,因此您可能希望找到更好的托管服务提供商。
我需要我们的应用服务器通过托管在 goddady 上的邮件服务器向我们的客户发送电子邮件
中描述的案例我们添加了MX记录但是邮寄不起作用;我们用我们使用的库附上报告错误:
技术数据
- OS: ubuntu 16.07
- 语言:PHP7.2
- 邮件库:phpmailer 6.0.5
PHP 邮件配置
$mail->SMTPDebug = 4;
$mail->isSMTP();
$mail->Host = 'smtp.office365.net';
$mail->SMTPAuth = true;
$mail->Username = MAIL_APP1;
$mail->Password = MAIL_APP1_PWD;
$mail->SMTPSecure = 'ssl';
$mail->Port = 993; //SMTP_PORT;
报告的错误
2018-09-14 16:21:51 SERVER - & gt; CLIENT: * OK The Microsoft Exchange IMAP4 service is ready.
[QwBPADIAUABSADAANgBDAEEAMAAwADUANQAuAG4AYQBtAHAAcgBkADAANgAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A] * BYE Connection is closed. 13
2018-09-14 16:21:51 SMTP NOTICE: EOF caught while checking if connected
SMTP Error: Could not authenticate.
SMTP Error: Could not authenticate.
实现
新配置:
$mail->SMTPDebug = 4;
$mail->isSMTP();
$mail->DKIM_domain = '127.0.0.1';
$mail->Host = 'smtpout.secureserver.net';
$mail->SMTPAuth = true;
$mail->Username = MAIL_APP1;
$mail->Password = MAIL_APP1_PWD;
$mail->SMTPSecure = 'ssl';
$mail->Port = 465; //SMTP_PORT;
新错误:
2018-09-20 01:34:47 Connection: opening to ssl://smtpout.secureserver.net:465, timeout=300, options=array()<br>
2018-09-20 01:34:47 Connection: opened<br>
2018-09-20 01:34:47 SMTP INBOUND: "220 p3plsmtpa12-05.prod.phx3.secureserver.net :SMTPAUTH: ESMTP"<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 220 p3plsmtpa12-05.prod.phx3.secureserver.net :SMTPAUTH: ESMTP<br>
2018-09-20 01:34:47 CLIENT -> SERVER: EHLO app.persaerp.com<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-p3plsmtpa12-05.prod.phx3.secureserver.net hello [167.99.172.180], secureserver.net"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-HELP"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-AUTH LOGIN PLAIN"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-SIZE 30000000"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-PIPELINING"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250-8BITMIME"<br>
2018-09-20 01:34:47 SMTP INBOUND: "250 OK"<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 250-p3plsmtpa12-05.prod.phx3.secureserver.net hello [167.99.172.180], secureserver.net250-HELP250-AUTH LOGIN PLAIN250-SIZE 30000000250-PIPELINING250-8BITMIME250 OK<br>
2018-09-20 01:34:47 Auth method requested: UNSPECIFIED<br>
2018-09-20 01:34:47 Auth methods available on the server: LOGIN,PLAIN<br>
2018-09-20 01:34:47 Requested auth method not available: <br>
2018-09-20 01:34:47 Auth method selected: LOGIN<br>
2018-09-20 01:34:47 CLIENT -> SERVER: AUTH LOGIN<br>
2018-09-20 01:34:47 SMTP INBOUND: "334 VXNlcm5hbWU6"<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 334 VXNlcm5hbWU6<br>
2018-09-20 01:34:47 CLIENT -> SERVER: aW5mb0BwZXJzYWVycC5jb20=<br>
2018-09-20 01:34:47 SMTP INBOUND: "334 UGFzc3dvcmQ6"<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 334 UGFzc3dvcmQ6<br>
2018-09-20 01:34:47 CLIENT -> SERVER: UGVyJGFFUlAyMDE4<br>
2018-09-20 01:34:47 SMTP INBOUND: "535 Authentication Failed for info@persaerp.com. User does not have any relays assigned."<br>
2018-09-20 01:34:47 SERVER -> CLIENT: 535 Authentication Failed for info@persaerp.com. User does not have any relays assigned.<br>
2018-09-20 01:34:47 SMTP ERROR: Password command failed: 535 Authentication Failed for info@persaerp.com. User does not have any relays assigned.<br>
SMTP Error: Could not authenticate.<br>
2018-09-20 01:34:47 CLIENT -> SERVER: QUIT<br>
2018-09-20 01:34:47 SERVER -> CLIENT: <br>
2018-09-20 01:34:47 SMTP ERROR: QUIT command failed: <br>
2018-09-20 01:34:47 Connection: closed<br>
SMTP Error: Could not authenticate.<br>
该错误消息中有一个赠品:The Microsoft Exchange IMAP4 service
- 您不应该在 SMTP 连接上看到有关 IMAP 的消息,事实上,您正在连接到端口 993,即 IMAP。您应该使用端口 465 或 587,但是...
如 PHPMailer 文档所述,GoDaddy 默认阻止出站 SMTP,并强制您通过他们自己的邮件服务器进行中继。这打破了许多电子邮件要求,因此您可能希望找到更好的托管服务提供商。