<?php
date_default_timezone_set('Asia/Bangkok');
require 'PHPMailer-master/PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->CharSet = "utf-8";
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 1;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "smtp-mail.outlook.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "
xxxx@hotmail.com";
//Password to use for SMTP authentication
$mail->Password = "253714xxxx";
//Set who the message is to be sent from
$mail->setFrom('
xxx@gmail.com', 'dew dew');
//Set who the message is to be sent to
$mail->addAddress('
xxxx@gmail.com','My Name');
//Set the subject line
$mail->Subject = 'Test Message';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
//$mail->msgHTML(file_get_contents('content.html'), dirname(__FILE__));
$mail->msgHTML("ทดสอบ Message");
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
นี่คือ Code ส่ง Email ผมครับ
ซึ่งตรง
$mail->Username = "
xxxx@hotmail.com";
//Password to use for SMTP authentication
$mail->Password = "253714xxxx";
ผมใส่ Email เก่าผมที่เป็น Hotmail ก็ส่งใช้งานได้ปกติครับ แต่พอเปลี่ยนมาเป็น Email ใหม่ ดันขึ้น Error เฉยเลยครับ
ผมเลยงงเลยว่าทำไมมันส่งไม่ไป ทั้งๆ ที่การตั้งค่าผมใช้แบบเดิมทุกอย่าง
CLIENT -> SERVER: STARTTLS
CLIENT -> SERVER: EHLO 127.0.0.1
CLIENT -> SERVER: AUTH LOGIN
CLIENT -> SERVER: Y29wY2FwMjAxN0Bob3RtYWlsLmNvbQ==
CLIENT -> SERVER: MDgzNTk5MjY4MGE=
CLIENT -> SERVER: MAIL FROM:<
sdppp9@gmail.com>
CLIENT -> SERVER: RCPT TO:<
likexxxxdota@gmail.com>
CLIENT -> SERVER: DATA
CLIENT -> SERVER: Date: Fri, 27 Jan 2017 22:36:51 +0700
CLIENT -> SERVER: To: sunday <
lixxxxdota@gmail.com>
CLIENT -> SERVER: From: dew dew <
xxxp9@gmail.com>
CLIENT -> SERVER: Subject: =?utf-8?B?4Lii4Li34LiZ4Lii4Lix4LiZ4Lil4LiH4LiX4Liw4LmA4Lia4Li14Lii4LiZ?=
CLIENT -> SERVER: =?utf-8?B?IC0g4LmA4LiE4Lij4Li34LmI4Lit4LiH4LiI4Lix4LiB4Liq4Liy4Lij?=
CLIENT -> SERVER: =?utf-8?B?4Lit4Lit4LiZ4LmE4Lil4LiZ4LmM?=
CLIENT -> SERVER: Message-ID: <
8df7a000ec013f74376d744e500f2bc2@127.0.0.1>
CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.16 (
https://github.com/PHPMailer/PHPMailer )
CLIENT -> SERVER: MIME-Version: 1.0
CLIENT -> SERVER: Content-Type: multipart/alternative;
CLIENT -> SERVER: boundary="b1_8df7a000ec013f74376d744e500f2bc2"
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: This is a multi-part message in MIME format.
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_8df7a000ec013f74376d744e500f2bc2
CLIENT -> SERVER: Content-Type: text/plain; charset=utf-8
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: สวัสดี เข้าสู่การยืนยันตัวตนผ่าน email
CLIENT -> SERVER: คลิกตามลิงค์ข้างล่างนี้เพื่อยืนยัน
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_8df7a000ec013f74376d744e500f2bc2
CLIENT -> SERVER: Content-Type: text/html; charset=utf-8
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: สวัสดี เข้าสู่การยืนยันตัวตนผ่าน email <br>
CLIENT -> SERVER: basket shop คลิกตามลิงค์ข้างล่างนี้เพื่อยืนยัน <br>
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_8df7a000ec013f74376d744e500f2bc2--
CLIENT -> SERVER:
CLIENT -> SERVER: .
SMTP ERROR: DATA END command failed: 550 5.3.4 554-554 5.2.0 STOREDRV.Deliver; delivery result banner
SMTP Error: data not accepted.
Mailer Error: SMTP Error: data not accepted.SMTP server error: DATA END command failed Detail: 554-554 5.2.0 STOREDRV.Deliver; delivery result banner SMTP code: 550 Additional SMTP info: 5.3.4CLIENT -> SERVER: QUIT
SMTP ERROR: QUIT command failed: 554-554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:6900000