PHPMailer在发送邮件时遇到问题
我已将PHPMailer的代码放在我要发送邮件但邮件未送达的文件中。我尝试了普通的PHPMailer在发送邮件时遇到问题,php,phpmailer,Php,Phpmailer,我已将PHPMailer的代码放在我要发送邮件但邮件未送达的文件中。我尝试了普通的mail()。这可能是主机服务的问题吗 include('PHPMailer-master/PHPMailerAutoload.php'); $mail = new PHPMailer; // Set PHPMailer to use the sendmail transport $mail->isSendmail(); //Set who the message is to be se
mail()。这可能是主机服务的问题吗
include('PHPMailer-master/PHPMailerAutoload.php');
$mail = new PHPMailer;
// Set PHPMailer to use the sendmail transport
$mail->isSendmail();
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress( $_POST['RequestedEmail'], 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer sendmail test';
//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("");
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
注意:对php来说是个新手,我尝试了php的mail()
本机函数和phpmailer。两人都表示邮件已发送,并显示了成功消息,但消息未送达。我问了托管服务器上的技术人员,他们回答说垃圾邮件拦截器已经阻止了这些邮件。因此,他们要求提供消息的内容和标题,以确认消息是否清晰,并解除对垃圾邮件的阻止。:) $mail->ErrorInfo
是怎么说的?如果邮件正在悄无声息地消失,听起来您的本地邮件服务器不工作或配置错误。检查您的邮件服务器日志,通常在/var/log/mail.log
中。Hey everyone可能重复。。很抱歉我回不来了。。是的,托管服务技术人员回答说,垃圾邮件拦截程序正在拦截邮件。