使用GCE实例从wordpress bitnami build发送邮件时遇到问题。
我知道普通的SMTP端口在GCE上已关闭,但我使用的是gmail API,非常类似于以下指南来创建API连接。 http://www.wpbeginner.com/plugins/how-to-send-email-in-wordpress-using-the-gmail-smtp-server/
所有设置似乎没问题,测试电子邮件显示以下内容;
2017-11-01 18:19:56 Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array ()
2017-11-01 18:19:57 Connection: opened
2017-11-01 18:19:57 SMTP -> get_lines(): $data is ""
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "220 smtp.gmail.com ESMTP m126sm942672wmf.31 - gsmtp"
2017-11-01 18:19:57 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP m126sm942672wmf.31 - gsmtp
2017-11-01 18:19:57 CLIENT -> SERVER: EHLO www.MYDOMAIN.com
2017-11-01 18:19:57 SMTP -> get_lines(): $data is ""
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "250-smtp.gmail.com at your service, [35.189.77.174]"
2017-11-01 18:19:57 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [35.189.77.174]"
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "250-SIZE 35882577"
2017-11-01 18:19:57 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [35.189.77.174]250-SIZE 35882577"
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "250-8BITMIME"
2017-11-01 18:19:57 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [35.189.77.174]250-SIZE 35882577250-8BITMIME"
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
2017-11-01 18:19:57 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [35.189.77.174]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES"
2017-11-01 18:19:57 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [35.189.77.174]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES"
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "250-PIPELINING"
2017-11-01 18:19:57 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [35.189.77.174]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING"
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "250-CHUNKING"
2017-11-01 18:19:57 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [35.189.77.174]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING"
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "250 SMTPUTF8"
2017-11-01 18:19:57 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [35.189.77.174]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2017-11-01 18:19:57 Auth method requested: XOAUTH2
2017-11-01 18:19:57 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
2017-11-01 18:19:57 CLIENT -> SERVER: QUIT
2017-11-01 18:19:57 SMTP -> get_lines(): $data is ""
2017-11-01 18:19:57 SMTP -> get_lines(): $str is "221 2.0.0 closing connection m126sm942672wmf.31 - gsmtp"
2017-11-01 18:19:57 SERVER -> CLIENT: 221 2.0.0 closing connection m126sm942672wmf.31 - gsmtp
2017-11-01 18:19:57 Connection: closed
似乎连接和授权很好,但不会发送/接收电子邮件。我尝试过TSL(587)和SSL(465)
有没有人有解决方案?
谢谢
答案 0 :(得分:0)
尝试将选项设置为不太安全的http://www.google.com/settings/security/lesssecureapps
如果你也设置了gsuit,那么两者都设置得不太安全。 http://admin.google.com/