duanhuang2150 2015-12-02 01:32
浏览 112
已采纳

无法从PHPMailer发送电子邮件,没有错误,消息成功

I am trying to send email using PHPMailer

I have all the correct setting and the email is sent succesfully according to the CPanel Email Trace.

However, I am not receiving any emails

This only occurs if I send to Gmail (I haven't tested yahoo or any other). If I send to my own domain, i.e. @open-plant.com.. it works fine. Email is received

I have checked GMAIL spam, trashcan, junk mail and etc... it is not going to those places.

The Email trace shows succesfull but NO email at azrinsani@gmail.com:

vent: success success
User: azrinsani
Domain:   open-plant.com
Sender:   sales@open-plant.com
Sent Time:    Dec 2, 2015 9:25:09 AM
Sender Host:  pa49-196-132-8.pa.vic.optusnet.com.au
Sender IP Address:    49.196.132.8
Authentication:   dovecot_login
Spam Score:   0
Recipient:    azrinsani@gmail.com
Delivery User:    -remote-
Delivery Domain:  
Delivered To: azrinsani@gmail.com
Router:   smarthost_dkim
Transport:    remote_smtp_smart_dkim
Out Time: Dec 2, 2015 9:25:09 AM
ID:   1a3wAX-003r8M-GZ
Delivery Host:    se3-syd.hostedmail.net.au
Delivery IP Address:  103.252.152.0/24
Size: 709 bytes
Result:   Accepted

The following is my phpcode

<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;



$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->Port = 465; // or 587
$mail->Host = 'c1s4-2e-syd.hosting-services.net.au'; // "ssl://smtp.gmail.com" didn't worked
$mail->SMTPSecure = 'ssl';

$mail->Username = "sales@open-plant.com";
$mail->Password = "PASSWORDCENSORED";
$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.

$mail->From = "sales@open-plant.com";
$mail->FromName = "Open-Plant";
$mail->addAddress("azrinsani@gmail.com","User 1");

$mail->Subject = "TESTING PHPMailer";
$mail->Body = "Hi,<br /><br />This system is working perfectly.";

if(!$mail->Send())
    echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
    echo "Message has been sent";

?>
  • 写回答

1条回答 默认 最新

  • dream8877 2015-12-02 09:47
    关注

    Problem Solved!

    OK, it turns out that my Hosting Server was blocking the email messages. They said they had a spam filter and my email got caught. So, lesson learned= Don't trust email traces... cause their email traces said everything was fine!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 在若依框架下实现人脸识别
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同