1
我在ajax的smtp中收到奇怪的響應。我正在使用下面的代碼smtp。ajax中的未接受的SMTP響應
require_once 'PHPMailer/PHPMailerAutoload.php';
$response = array();
//Create a new PHPMailer instance
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->Host = "mail.example.com";
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->Username = "Y**********[email protected]";
$mail->Password = "Your Password";
$mail->setFrom($to, $name);
$mail->addAddress('O**********[email protected]', 'Owner Name');
$mail->Subject = $subject;
$message = '<div style="background:#F5F5F5; padding:10px;">
<p>'.$message.'</p><br />
<div>Name : '.$name.'</div><br />
<div>Phone : '.$phone.'</div><br />
</div>';
$mail->msgHTML($message);
$mail->AltBody = 'This is a plain-text message body';
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
if (!$mail->send()){
// For Debugging
//return "Mailer Error: " . $mail->ErrorInfo;
$response['error'] = 'Something not right. Please check your details.';
}else{
$response['success'] = 'Your email has been sent successfully.';
}
echo json_encode($response, JSON_PRETTY_PRINT);
當我通過ajax調用該頁面時,上面的代碼給了我下面的響應。
CLIENT -> SERVER: EHLO i******9.com
CLIENT -> SERVER: STARTTLS
CLIENT -> SERVER: EHLO i******9.com
CLIENT -> SERVER: AUTH LOGIN
CLIENT -> SERVER: bm8tcmVwbHlAaWVpMjAwOS5jb20=
CLIENT -> SERVER: R29vZ2xlMDAxIQ==
CLIENT -> SERVER: MAIL FROM:<i******[email protected]>
CLIENT -> SERVER: RCPT TO:<no-rep[email protected]******9.com>
CLIENT -> SERVER: DATA
CLIENT -> SERVER: Date: Thu, 9 Mar 2017 05:53:58 +0000
CLIENT -> SERVER: To: Contact Us Form <[email protected]******9.com>
CLIENT -> SERVER: From: Ai******9z <ii******[email protected]>
CLIENT -> SERVER: Subject: Bug
CLIENT -> SERVER: Message-ID: <[email protected]******9.com>
CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
CLIENT -> SERVER: MIME-Version: 1.0
CLIENT -> SERVER: Content-Type: multipart/alternative;
CLIENT -> SERVER: boundary="b1_e40a0335e2698ee9e28de514c2eb325a"
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: This is a multi-part message in MIME format.
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_e40a0335e2698ee9e28de514c2eb325a
CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: This is a plain-text message body
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_e40a0335e2698ee9e28de514c2eb325a
CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: <div style="background:#F5F5F5; padding:10px;">
CLIENT -> SERVER: <p>This is for form testing</p><br />
CLIENT -> SERVER: <div>Name : Ai******9z</div><br />
CLIENT -> SERVER: <div>Phone : 123456789</div><br />
CLIENT -> SERVER: </div>
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_e40a0335e2698ee9e28de514c2eb325a--
CLIENT -> SERVER:
CLIENT -> SERVER: .
CLIENT -> SERVER: QUIT
{ "success": "Your email has been sent successfully." }
有人可以請指導我什麼是這個問題,我可以解決它。我想感謝有人指導我解決這個問題。
你可以看到消息在年底'{「成功」:「您的電子郵件已經發送成功。」 }'所以我認爲這意味着沒有錯誤內部SMTP –
有沒有錯誤..... –
其打印您的調試輸出 –