使用PHPMailer向SMTP发送电子邮件的问题

时间:2021-05-03 18:11:57

I get the following error log when trying to send a message through an Exchange server:

尝试通过Exchange服务器发送邮件时,我收到以下错误日志:

SMTP -> get_lines(): $data was "" 
SMTP -> get_lines(): $str is "220 mail.borschow.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Tue, 7 Apr 2009 21:56:53 -0400 " 
SMTP -> get_lines(): $data is "220 mail.borschow.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Tue, 7 Apr 2009 21:56:53 -0400 " 
SMTP -> FROM SERVER: 220 mail.borschow.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Tue, 7 Apr 2009 21:56:53 -0400 
SMTP -> get_lines(): $data was "" 
SMTP -> get_lines(): $str is "250-mail.borschow.com Hello [10.0.254.231] " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] " 
SMTP -> get_lines(): $str is "250-TURN " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN " 
SMTP -> get_lines(): $str is "250-SIZE " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE " 
SMTP -> get_lines(): $str is "250-ETRN " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN " 
SMTP -> get_lines(): $str is "250-PIPELINING " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING " 
SMTP -> get_lines(): $str is "250-DSN " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN " 
SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES " 
SMTP -> get_lines(): $str is "250-8bitmime " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime " 
SMTP -> get_lines(): $str is "250-BINARYMIME " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME " 
SMTP -> get_lines(): $str is "250-CHUNKING " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING " 
SMTP -> get_lines(): $str is "250-VRFY " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY " 
SMTP -> get_lines(): $str is "250-X-LINK2STATE " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-X-LINK2STATE " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-X-LINK2STATE " 
SMTP -> get_lines(): $str is "250-XEXCH50 " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-X-LINK2STATE 250-XEXCH50 " 
SMTP -> get_lines(): $data was "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-X-LINK2STATE 250-XEXCH50 " 
SMTP -> get_lines(): $str is "250 OK " 
SMTP -> get_lines(): $data is "250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-X-LINK2STATE 250-XEXCH50 250 OK " 
SMTP -> FROM SERVER: 250-mail.borschow.com Hello [10.0.254.231] 250-TURN 250-SIZE 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-X-LINK2STATE 250-XEXCH50 250 OK 
SMTP -> get_lines(): $data was "" 
SMTP -> get_lines(): $str is "504 5.7.4 Unrecognized authentication type. " 
SMTP -> get_lines(): $data is "504 5.7.4 Unrecognized authentication type. " 
SMTP -> ERROR: AUTH not accepted from server: 504 5.7.4 Unrecognized authentication type. 
SMTP -> get_lines(): $data was "" 
SMTP -> get_lines(): $str is "250 2.0.0 Resetting " 
SMTP -> get_lines(): $data is "250 2.0.0 Resetting " 
SMTP -> FROM SERVER: 250 2.0.0 Resetting 

Notes

  • I've tried with my assigned user/password, but the administrator said there's not even a need to use a user/password when sending. So I also tried without it, with no success.
  • 我尝试使用我指定的用户/密码,但管理员说在发送时甚至不需要使用用户/密码。所以我也试过没有它,没有成功。

  • I even tried with smtp.gmail.com
  • 我甚至尝试过使用smtp.gmail.com

UPDATE (4/16/2009)

ok, I found my problem. I am using an SMTP server that permits sending messages without authentication. Therefore I removed the login and password from my code. But I forgot to set the "uses authentication" flag to false. Now it's working.

好的,我发现了我的问题。我正在使用SMTP服务器,允许无需身份验证即可发送邮件。因此,我从代码中删除了登录名和密码。但我忘了将“使用身份验证”标志设置为false。现在它正在运作。

Thanks for the Help!

谢谢您的帮助!

3 个解决方案

#1


remember that gmail need ssl for connecting and also they dont use the standard smtp port. If you are using an old version of phpMailer you need make a kind of hack to put it working.

记住gmail需要ssl进行连接,而且他们也不使用标准的smtp端口。如果您使用的是旧版本的phpMailer,则需要进行一种破解才能使其正常工作。

Here there is a page that can help you link text

这里有一个页面可以帮助您链接文本

#2


SMTP -> get_lines(): $str is "504 5.7.4 Unrecognized authentication type. " 
SMTP -> get_lines(): $data is "504 5.7.4 Unrecognized authentication type. " 
SMTP -> ERROR: AUTH not accepted from server: 504 5.7.4 Unrecognized authentication type. 

What authentication are you using. I think thats causing the issue. Post the code here so that we can help more.

你使用什么身份验证。我认为那会导致这个问题。在此处发布代码,以便我们可以提供更多帮助。

#3


Try adding this:

尝试添加此:

$mail->SMTPAuth = true;

$ mail-> SMTPAuth = true;

$mail->SMTPSecure = "tls";

$ mail-> SMTPSecure =“tls”;

TLS is needed for many SMTP servers these days.

如今,许多SMTP服务器都需要TLS。

#1


remember that gmail need ssl for connecting and also they dont use the standard smtp port. If you are using an old version of phpMailer you need make a kind of hack to put it working.

记住gmail需要ssl进行连接,而且他们也不使用标准的smtp端口。如果您使用的是旧版本的phpMailer,则需要进行一种破解才能使其正常工作。

Here there is a page that can help you link text

这里有一个页面可以帮助您链接文本

#2


SMTP -> get_lines(): $str is "504 5.7.4 Unrecognized authentication type. " 
SMTP -> get_lines(): $data is "504 5.7.4 Unrecognized authentication type. " 
SMTP -> ERROR: AUTH not accepted from server: 504 5.7.4 Unrecognized authentication type. 

What authentication are you using. I think thats causing the issue. Post the code here so that we can help more.

你使用什么身份验证。我认为那会导致这个问题。在此处发布代码,以便我们可以提供更多帮助。

#3


Try adding this:

尝试添加此:

$mail->SMTPAuth = true;

$ mail-> SMTPAuth = true;

$mail->SMTPSecure = "tls";

$ mail-> SMTPSecure =“tls”;

TLS is needed for many SMTP servers these days.

如今,许多SMTP服务器都需要TLS。