为什么我无法收到递送或阅读收据?

时间:2016-12-31 12:02:29

标签: php email smtp phpmailer

我正在使用phpmailer类开发该功能。

以下是发送电子邮件和阅读回执请求的简单脚本。

require 'PHPMailerAutoload.php';
    $mail = new PHPMailer;
    $mail->isSMTP();
    $mail->SMTPDebug = 2;
    $mail->Debugoutput = 'html';
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 587;
    $mail->SMTPSecure = 'tls';
    $mail->SMTPAuth = true;
    $mail->Username = "cshailesh157@gmail.com";
    $mail->Password = "******************";
    $mail->ConfirmReadingTo = "cshailesh157@gmail.com";
    $mail->addCustomHeader('Return-Receipt-To',"Shailesh Chauhan <cshailesh157@gmail.com>");
    $mail->addCustomHeader('Read-Receipt-To',"Shailesh Chauhan <cshailesh157@gmail.com>");
    $mail->addCustomHeader('X-Confirm-Reading-To',"Shailesh Chauhan <cshailesh157@gmail.com>");
    $mail->addCustomHeader('Generate-Delivery-Report',"Shailesh Chauhan <cshailesh157@gmail.com>");
    $mail->addCustomHeader('Disposition-Notification-To',"Shailesh Chauhan <cshailesh157@gmail.com>");
    $mail->setFrom('cshailesh157@gmail.com', 'Shailesh Chauhan');
    $mail->addReplyTo('cshailesh157@gmail.com');
    $mail->IsHTML(true);
    $mail->addAddress('test.presntr@gmail.com');
    $mail->Subject = 'Testing For SMTP';
    $mail->Body = 'Testing For SMTP Body';
    if($mail->send()){
        echo 'send';
    }else{
        echo "Mailer Error: " . $mail->ErrorInfo;
    }

邮件已成功发送。但我无法收到任何阅读回执

1 个答案:

答案 0 :(得分:1)

是否发送阅读回执完全取决于接收电子邮件客户端。由于垃圾邮件发送者的广泛滥用,大多数人不再支持他们了。因此,您可以完全按照自己的要求提出要求,但实际上您不太可能获得任何要求。