Assume the parameters below represent
SMTP Server: [SMTP_SERVER]
Client Server Name: [CLIENT_SERVER_NAME]
Configure all the necessary parameter in SMTP.php class provided by PHPMailer in examples folder, out of no luck, it just can't send email. Turn on the SMTP debug parameters in SMTP.php
// 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = 2;
SMTP -> FROM SERVER:220 [SMTP_SERVER] Microsoft ESMTP MAIL Service, Version: 5.0.2195.7381 ready at Mon, 23 Sep 2013 14:38:12 +0800 CLIENT -> SMTP: EHLO [[CLIENT_SERVER_NAME]] SMTP -> FROM SERVER: 501 5.5.4 Invalid Address SMTP -> ERROR: EHLO not accepted from server: 501 5.5.4 Invalid Address CLIENT -> SMTP: HELO [[CLIENT_SERVER_NAME]] SMTP -> FROM SERVER: 501 5.5.4 Invalid Address SMTP -> ERROR: HELO not accepted from server: 501 5.5.4 Invalid Address CLIENT -> SMTP: AUTH LOGIN SMTP -> ERROR: AUTH not accepted from server: 503 5.5.2 Send hello first CLIENT -> SMTP: quit SMTP -> FROM SERVER:221 2.0.0 [SMTP_SERVER] Service closing transmission channel SMTP Connect() failed. Mailer Error: SMTP Connect() failed.
Troubleshoot the debug message and discovered that special character '[' and ']' is appended to the [SMTP_SERVER_NAME] value.
Comment out 5 lines of source code at line 720 in "class.smtp.php" as described below and replace with a new 5 lines of source code as described below that removed '[' and ']' characters:
//if(!$this->SendHello('EHLO', "[" . $host . "]")) { // if(!$this->SendHello('HELO', "[" . $host . "]")) { // return false; // } //} if(!$this->SendHello('EHLO', $host)) { if(!$this->SendHello('HELO',$host)) { return false; } }
No comments:
Post a Comment