Heim  >  Artikel  >  Backend-Entwicklung  >  phpmailer发信时遇见了一个很苦逼的问题

phpmailer发信时遇见了一个很苦逼的问题

WBOY
WBOYOriginal
2016-06-23 14:12:241528Durchsuche

phpmailer php 发邮件

各位大大好!我遇见了一个很苦逼的发信问题,先贴下问题的细节
SMTP -> FROM SERVER: 250-m1.mydomain.com250-PIPELINING250-SIZE 15728640250-VRFY250-ETRN250-STARTTLS250-ENHANCEDSTATUSCODES250-8BITMIME250 DSNCLIENT -> SMTP: STARTTLSSMTP -> FROM SERVER:220 2.0.0 Ready to start TLSCLIENT -> SMTP: EHLO localhost.localdomain250-PIPELINING250-SIZE 15728640250-VRFY250-ETRN250-AUTH PLAIN250-ENHANCEDSTATUSCODES250-8BITMIMESMTP -> ERROR: AUTH not accepted from server: 535 5.7.8 Error: authentication failed: Invalid authentication mechanismCLIENT -> SMTP: RSETSMTP -> FROM SERVER:250 2.0.0 OkCLIENT -> SMTP: MAIL FROM:SMTP -> FROM SERVER:250 2.1.0 OkCLIENT -> SMTP: RCPT TO:SMTP -> FROM SERVER:554 5.7.1 : Relay access deniedSMTP -> ERROR: RCPT not accepted from server: 554 5.7.1 : Relay access deniedCLIENT -> SMTP: quitSMTP -> FROM SERVER:221 2.0.0 Bye

上面的错误,是我碰到的,有提示 Invalid authentication mechanism ,没有开启这个认证.
我就跑到 DOVECOT 认证服务器上加上了一个认证,现在的认证方式有 PLAIN 和 LOGIN
现在认证是通过了.不过又出现了新的问题.
新的问题如下.
SMTP -> FROM SERVER:220 m2.mydomain.com ESMTP hairCLIENT -> SMTP: EHLO localhost.localdomainSMTP -> FROM SERVER: 250-m2.mydomain.com250-PIPELINING250-SIZE 15728640250-VRFY250-ETRN250-STARTTLS250-ENHANCEDSTATUSCODES250-8BITMIME250 DSNCLIENT -> SMTP: STARTTLSSMTP -> FROM SERVER:220 2.0.0 Ready to start TLSCLIENT -> SMTP: EHLO localhost.localdomainSMTP -> FROM SERVER: 250-m2.mydomain.com250-PIPELINING250-SIZE 15728640250-VRFY250-ETRN250-AUTH PLAIN LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSNCLIENT -> SMTP: AUTH LOGINCLIENT -> SMTP: c2VydmljZUBoYWlyb25saW5lc2FsZS5jb20=CLIENT -> SMTP: QURGYXMmZlNIa2pQI2E=SMTP -> ERROR: Password not accepted from server: 535 5.7.8 Error: authentication failed:UGFzc3dvcmQ6                                                                                       CLIENT -> SMTP: RSETSMTP -> FROM SERVER:250 2.0.0 OkCLIENT -> SMTP: MAIL FROM:<service@mydomain.com>SMTP -> FROM SERVER:250 2.1.0 OkCLIENT -> SMTP: RCPT TO:<to@163.com>SMTP -> FROM SERVER:554 5.7.1 <to@163.com>: Relay access deniedSMTP -> ERROR: RCPT not accepted from server: 554 5.7.1 <to@163.com>: Rel                                                                                        ay access deniedCLIENT -> SMTP: quitSMTP -> FROM SERVER:221 2.0.0 Bye

现在的提示是认证失败,你玛,怎么会出现此种坑爹的情况
我在FOXMAIL上用这个密码发的好好的,怎么会这样.
下面帖上我发信时的代码
require_once('class.phpmailer.php');$mail = new PHPMailer();$mail->IsSMTP();$mail->Host = "m2.mydomain.com";$mail->Port = 26;$mail->SMTPAuth = true;$mail->SetFrom('service@mydomain.com', 'lopl.net');$mail->AddReplyTo('service@mydomain.com', 'lopl.net');$mail->Username = 'service@mydomain.com';$mail->Password = 'mypassword';$mail->AddAddress("to@163.com");$mail->Subject = "New Fax";$mail->SMTPDebug = 3;$mail->SMTPSecure = 'tls'; // or $mail->SMTPSecure = 'ssl';$mail->Body = "You have new FAX ";$mail->Send();echo "Error sending: " . $mail->ErrorInfo;

另:当用PHPMAILER发信时,出现以上两种情况的时候,用FOXMAIL测试,均是正常.请大神救命.在此拜谢!!!

回复讨论(解决方案)

不知道为什么是 $mail->Port =  26;

端口都没问题

现在是用PHPMAILER发,提示密码通不过.
但是FOXMAIL是好的,一直可以正常发送....

你的开发环境是什么,有没有禁用了PHPMailer里面的自带函数,例如fsockopen函数被禁用了?

fsockopen函数没被禁用,开发环境就是LAMP,没有禁用自带的函数..

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn