1

我正在使用 PHPmailer(简单邮件)发送电子邮件。我添加了标题,因为我想要一份 emal 的已读回执。这是我的代码。

define(ADMINMAIL, 'test1@gmail.com');

try{
    $mail  = new PHPMailer(); 
    $ConfirmReadingTo = 'kendreparesh@gmail.com';

    $msPriority = 1;
    $mail->AddAddress('xyz@gmail.com', 'Mr XYZ');

    $mail->AddCustomHeader( 'X-pmrqc: 1' );
    $mail->AddReplyTo(ADMINMAIL,"Admin");
    $mail->SetFrom(ADMINMAIL, 'Admin');

    $mail->FromName = "Support Team<".ADMINMAIL.">";
    $mail->AddCustomHeader("X-MSMail-Priority: $msPriority" );
    $mail->AddCustomHeader("Priority: $msPriority" );
    $mail->addCustomHeader("Return-Receipt-To: $ConfirmReadingTo");
    $mail->addCustomHeader("X-Confirm-Reading-To: $ConfirmReadingTo");
    $mail->addCustomHeader("Disposition-notification-to: $ConfirmReadingTo");
    $mail->ConfirmReadingTo = 'kendreparesh@gmail.com';
    $mail->WordWrap = 200;
    $mail->Encoding = "8bit";
    $mail->CharSet = 'UTF-8';
    $mail->IsHTML(true);

    $mail->Subject = "Subject line ";
    $mail->MsgHTML("This is email body");
    $mail->Send(); 

} catch (Exception $e) {
    echo "<br/>".$e->getMessage(); //Boring error messages from anything else!
}

如果你能看到我已经尝试过请求已读回执,但没有运气:(

还有一件事,以我公司地址为目标的电子邮件从未收到,甚至在垃圾邮件或垃圾邮件文件夹中也没有。

请指教,我该怎么办?

提前致谢,

4

1 回答 1

1
$mail->addCustomHeader("Disposition-Notification-To: $ConfirmReadingTo");

为我工作!注意大写字母

于 2016-01-26T17:40:07.577 回答