Phpmailer脚本显示消息:邮件发送成功,但是邮件客户端(gmail)在收件箱或垃圾邮件中均未收到。
这是我们用来发送邮件的代码
include "../include/db_mbrace_host.php";
//require '../dump/PHPMailer-master/PHPMailerAutoload.php';
//Create a new PHPMailer instance
include_once('../dump/PHPMailer-master/class.phpmailer.php');
require_once('../dump/PHPMailer-master/class.smtp.php');
$mail = new PHPMailer(true);
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
$mail->IsHTML(true);
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Host = "***";
$mail->Port =587;
$mail->Username = "***";
$mail->Password = "***";
$mail->setFrom("ahamed.husain@ecitizen.in", '');
//Set an alternative reply-to address
$mail->addReplyTo('ahamed.husain@ecitizen.in', '');
//Set who the message is to be sent to
$mail->addAddress("mbrace.cloud@gmail.com", '');
//Set the subject line
$mail->Subject ="Test";
$mail->ConfirmReadingTo = 'mbrace.cloud@gmail.com';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->Body =nl2br ("Test");
//Replace the plain text body with one created manually
$mail->AltBody = 'Hello';
//Attach an image file
//send the message, check for errors
if (!$mail->send()) {
echo $mail->ErrorInfo;
}
else {
echo "Sent";
$idn=$_REQUEST['id']+1;
}
调试代码显示,尽管邮件未到达邮件客户端,但一切都很好。我们试图发送给各种邮件客户端,但无济于事。您可以按照以下网址进行检查:https://ecitizen.in/appln_enterprise/es/send_mail.php?do=asdnnn。告诉我们该怎么办。