Home > Article > Backend Development > phpmailer发信时遇见了一个很苦逼的问题
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
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
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;
不知道为什么是 $mail->Port = 26;
端口都没问题
现在是用PHPMAILER发,提示密码通不过.
但是FOXMAIL是好的,一直可以正常发送....
你的开发环境是什么,有没有禁用了PHPMailer里面的自带函数,例如fsockopen函数被禁用了?
fsockopen函数没被禁用,开发环境就是LAMP,没有禁用自带的函数..