首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHPMailer在发送邮件时出现问题

PHPMailer在发送邮件时出现问题
EN

Stack Overflow用户
提问于 2015-04-10 23:42:37
回答 1查看 171关注 0票数 0

我已经将PHPMailer的代码放在了我想要发送邮件但邮件没有送达的文件中。我尝试了普通的mail()方法,但是两者都发送了消息,但是消息没有被传递。这会是主机服务的问题吗?

代码语言:javascript
复制
  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新手

EN

回答 1

Stack Overflow用户

发布于 2015-04-11 05:50:20

我尝试了php和phpmailer的mail()原生函数。两人都表示邮件已发送,并显示成功消息,但消息未送达。我询问了托管服务器上的技术人员,他们回答说垃圾邮件拦截器已经阻止了消息。因此,他们要求邮件的内容和标题,以确认它是清楚的,并从垃圾邮件中解锁它。:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29565530

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档