dongxiegao3071 2012-11-07 11:05
浏览 31

PHPmailer类返回true但不传递电子邮件

I am trying to send an email in following way -

from : xyz@domain1.com  
reply-to : xyz@domain1.com  
to : abc@domain2.com  
cc : abc@domain3.com  

My email is getting delivered to the address mentioned in CC (If I replace the emails to and cc, then email is sent to the address mentioned in to)

For some reason, email is not getting delivered to the address abc@domain2.com. If I send the email manually to this address using outlook or gmail, then email is actually delivered. How can I debug this issue ?

I checked spam/junk directories as well, no emails over there. I tried using php mail() function as well as phpmailer class. Both of them return TRUE. What could the reason ? Please help.

$mail->From = "xyz@domain1.com";   
$mail->AddReplyTo("xyz@domain1.com");  
$mail->AddAddress("abc@domain2.com");  
$mail->AddCC("abc@domain3.com");  
$mail->Subject = $subject;  
$mail->Body = $message;  

if(! $mail->Send()) {  
    echo "Message was not sent";  
    echo "Mailer Error: " . $mail->ErrorInfo;  
    exit; 
} 
  • 写回答

3条回答 默认 最新

  • donglaohua1671 2012-11-07 11:31
    关注
    Try to set cofigurations beffore send (Gmail config):
    
    
    
        $mail = new Mailer();
        $mail->SMTPDebug = true;
        $mail->SMTPAuth = true;
        $mail->CharSet = 'utf-8';
        $mail->SMTPSecure = 'ssl';
        $mail->Host = 'smtp.gmail.com';
        $mail->Port = '465';
        $mail->Username = 'your login here';
        $mail->Password = 'your password here';
        $mail->Mailer = 'smtp';
        $mail->From = 'form mail address';
        $mail->FromName = 'from name';
        $mail->Sender = 'form mail';
        $mail->Priority = 3;
    
        $mail->AddAddress('mail', 'admin name');
        $mail->AddReplyTo('replay to', 'admin name');
        $mail->Subject = 'subject';
        $mail->Body = 'some HTML message here';
        $mail->IsHTML(true);
        if(!$this->Send()) {
            print_r('error: '. $mail->ErrorInfo); // Show errors   
     }
        $mail->ClearAddresses();
        $mail->ClearAttachments();
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大