phpmailer 用自己的qq可以发送邮件。换成公司的邮箱配置就不行了。说:500 Unknown Command: "STARTTLS"。请帮忙看看怎么回事,多谢大神!
附上发送成功和发送失败的代码:
配置qq发送成功:
2017-03-26 14:23:17 Connection: opening to smtp.qq.com:587, timeout=300, options=array ()
2017-03-26 14:23:17 Connection: opened
2017-03-26 14:23:17 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "220 smtp.qq.com Esmtp QQ Mail Server "
2017-03-26 14:23:17 SERVER -> CLIENT: 220 smtp.qq.com Esmtp QQ Mail Server
2017-03-26 14:23:17 CLIENT -> SERVER: EHLO oms.cc
2017-03-26 14:23:17 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-smtp.qq.com"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-PIPELINING"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-SIZE 73400320
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
50-SIZE 73400320"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-STARTTLS
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-STARTTLS"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-AUTH LOGIN PLAIN
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-STARTTLS
250-AUTH LOGIN PLAIN
"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-AUTH=LOGIN
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN
"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-MAILCOMPRESS
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN
250-MAILCOMPRESS
"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250 8BITMIME
"
2017-03-26 14:23:17 SERVER -> CLIENT: 250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN
250-MAILCOMPRESS
250 8BITMIME
2017-03-26 14:23:17 CLIENT -> SERVER: STARTTLS
2017-03-26 14:23:17 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "220 Ready to start TLS
"
2017-03-26 14:23:17 SERVER -> CLIENT: 220 Ready to start TLS
2017-03-26 14:23:17 CLIENT -> SERVER: EHLO oms.cc
2017-03-26 14:23:17 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-smtp.qq.com
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-PIPELINING
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-SIZE 73400320
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-AUTH LOGIN PLAIN
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-AUTH LOGIN PLAIN
"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-AUTH=LOGIN
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN
"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250-MAILCOMPRESS
"
2017-03-26 14:23:17 SMTP -> get_lines(): $data is "250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN
250-MAILCOMPRESS
"
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250 8BITMIME
"
2017-03-26 14:23:17 SERVER -> CLIENT: 250-smtp.qq.com
250-PIPELINING
250-SIZE 73400320
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN
250-MAILCOMPRESS
250 8BITMIME
2017-03-26 14:23:17 Auth method requested: UNKNOWN
2017-03-26 14:23:17 Auth methods available on the server: LOGIN,PLAIN
2017-03-26 14:23:17 Auth method selected: LOGIN
2017-03-26 14:23:17 CLIENT -> SERVER: AUTH LOGIN
2017-03-26 14:23:17 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "334 VXNlcm5hbWU6
"
2017-03-26 14:23:17 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2017-03-26 14:23:17 CLIENT -> SERVER: eWNtYmNkQHFxLmNvbQ==
2017-03-26 14:23:17 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "334 UGFzc3dvcmQ6
"
2017-03-26 14:23:17 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2017-03-26 14:23:17 CLIENT -> SERVER: eWNtYmNkLjc2NjQzMTEu
2017-03-26 14:23:17 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "235 Authentication successful
"
2017-03-26 14:23:17 SERVER -> CLIENT: 235 Authentication successful
2017-03-26 14:23:17 CLIENT -> SERVER: MAIL FROM:<ycmbcd@qq.com>
2017-03-26 14:23:17 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:17 SMTP -> get_lines(): $str is "250 Ok
"
2017-03-26 14:23:17 SERVER -> CLIENT: 250 Ok
2017-03-26 14:23:17 CLIENT -> SERVER: RCPT TO:<ycmbcd@qq.com>
2017-03-26 14:23:18 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:18 SMTP -> get_lines(): $str is "250 Ok
"
2017-03-26 14:23:18 SERVER -> CLIENT: 250 Ok
2017-03-26 14:23:18 CLIENT -> SERVER: DATA
2017-03-26 14:23:18 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:18 SMTP -> get_lines(): $str is "354 End data with <CR><LF>.<CR><LF>
"
2017-03-26 14:23:18 SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
2017-03-26 14:23:18 CLIENT -> SERVER: Date: Sun, 26 Mar 2017 22:23:17 +0800
2017-03-26 14:23:18 CLIENT -> SERVER: To: test <ycmbcd@qq.com>
2017-03-26 14:23:18 CLIENT -> SERVER: From: ycmbcd <ycmbcd@qq.com>
2017-03-26 14:23:18 CLIENT -> SERVER: Reply-To: ycmbcd@qq.com
2017-03-26 14:23:18 CLIENT -> SERVER: Subject: 11111
2017-03-26 14:23:18 CLIENT -> SERVER: Message-ID: <371aaeb4525d6c38537d69426e179187@oms.cc>
2017-03-26 14:23:18 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.23 (https://github.com/PHPMailer/PHPMailer)
2017-03-26 14:23:18 CLIENT -> SERVER: MIME-Version: 1.0
2017-03-26 14:23:18 CLIENT -> SERVER: Content-Type: multipart/alternative;
2017-03-26 14:23:18 CLIENT -> SERVER: boundary="b1_371aaeb4525d6c38537d69426e179187"
2017-03-26 14:23:18 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER: This is a multi-part message in MIME format.
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER: --b1_371aaeb4525d6c38537d69426e179187
2017-03-26 14:23:18 CLIENT -> SERVER: Content-Type: text/plain; charset=UTF-8
2017-03-26 14:23:18 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER: <p><font color="#ff0000" size="5">你好亲爱的1:</font></p><blockquote><p> 欢迎您购买我们的产品。</p></blockquote><p><br></p>
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER: --b1_371aaeb4525d6c38537d69426e179187
2017-03-26 14:23:18 CLIENT -> SERVER: Content-Type: text/html; charset=UTF-8
2017-03-26 14:23:18 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER: <p><font color="#ff0000" size="5">你好亲爱的1:</font></p><blockquote><p> 欢迎您购买我们的产品。</p></blockquote><p><br></p>
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER: --b1_371aaeb4525d6c38537d69426e179187--
2017-03-26 14:23:18 CLIENT -> SERVER:
2017-03-26 14:23:18 CLIENT -> SERVER: .
2017-03-26 14:23:18 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:18 SMTP -> get_lines(): $str is "250 Ok: queued as
"
2017-03-26 14:23:18 SERVER -> CLIENT: 250 Ok: queued as
2017-03-26 14:23:18 CLIENT -> SERVER: QUIT
2017-03-26 14:23:18 SMTP -> get_lines(): $data is ""
2017-03-26 14:23:18 SMTP -> get_lines(): $str is "221 Bye
"
2017-03-26 14:23:18 SERVER -> CLIENT: 221 Bye
2017-03-26 14:23:18 Connection: closed
ended
公司配置发信反馈错误:
2017-03-26 14:24:19 Connection: opening to smtp.lolipop.jp:587, timeout=300, options=array ()
2017-03-26 14:24:19 Connection: opened
2017-03-26 14:24:19 SMTP -> get_lines(): $data is ""
2017-03-26 14:24:19 SMTP -> get_lines(): $str is "220 smtp-proxy003.phy.lolipop.jp LOLIPOP-Fsecure
"
2017-03-26 14:24:19 SERVER -> CLIENT: 220 smtp-proxy003.phy.lolipop.jp LOLIPOP-Fsecure
2017-03-26 14:24:19 CLIENT -> SERVER: EHLO oms.cc
2017-03-26 14:24:19 SMTP -> get_lines(): $data is ""
2017-03-26 14:24:19 SMTP -> get_lines(): $str is "250-smtp-proxy003.phy.lolipop.jp Hi smtp-proxy003.phy.lolipop.lan [172.19.44.44]
"
2017-03-26 14:24:19 SMTP -> get_lines(): $data is "250-smtp-proxy003.phy.lolipop.jp Hi smtp-proxy003.phy.lolipop.lan [172.19.44.44]
"
2017-03-26 14:24:19 SMTP -> get_lines(): $str is "250-8BITMIME
"
2017-03-26 14:24:19 SMTP -> get_lines(): $data is "250-smtp-proxy003.phy.lolipop.jp Hi smtp-proxy003.phy.lolipop.lan [172.19.44.44]
250-8BITMIME
"
2017-03-26 14:24:19 SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN
"
2017-03-26 14:24:19 SMTP -> get_lines(): $data is "250-smtp-proxy003.phy.lolipop.jp Hi smtp-proxy003.phy.lolipop.lan [172.19.44.44]
250-8BITMIME
250-AUTH PLAIN LOGIN
"
2017-03-26 14:24:19 SMTP -> get_lines(): $str is "250 SIZE 102400000
"
2017-03-26 14:24:19 SERVER -> CLIENT: 250-smtp-proxy003.phy.lolipop.jp Hi smtp-proxy003.phy.lolipop.lan [172.19.44.44]
250-8BITMIME
250-AUTH PLAIN LOGIN
250 SIZE 102400000
2017-03-26 14:24:19 CLIENT -> SERVER: STARTTLS
2017-03-26 14:24:19 SMTP -> get_lines(): $data is ""
2017-03-26 14:24:19 SMTP -> get_lines(): $str is "500 Unknown Command: "STARTTLS" (LOLIPOP-Fsecure)
2017-03-26 14:24:19 SERVER -> CLIENT: 500 Unknown Command: "STARTTLS" (LOLIPOP-Fsecure)
2017-03-26 14:24:19 SMTP ERROR: STARTTLS command failed: 500 Unknown Command: "STARTTLS" (LOLIPOP-Fsecure)
2017-03-26 14:24:19 SMTP Error: Could not connect to SMTP host.
2017-03-26 14:24:19 CLIENT -> SERVER: QUIT
2017-03-26 14:24:20 SMTP -> get_lines(): $data is ""
2017-03-26 14:24:20 SMTP -> get_lines(): $str is "221 smtp-proxy003.phy.lolipop.jp closing connection. Have a wonderful day.
"
2017-03-26 14:24:20 SERVER -> CLIENT: 221 smtp-proxy003.phy.lolipop.jp closing connection. Have a wonderful day.
2017-03-26 14:24:20 Connection: closed
2017-03-26 14:24:20 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
邮件发送失败.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
那不就是你的公司SMTP不认识STARTTLS么,就是不支持STARTTLS呗
换