How to know that mail is sent and read by the user when sending mail using SMTP, PHPmailer

Does anyone know any solution for the below task

in my project, I send an email to the client using smtp and php mailer and gmail script. so when I send gmail, send mail to a specific client. for this I pass the gmail username and username which are valid. all mail is sent properly. but sometimes it happens that some client doesn’t receive mail, and at that time I can’t get or track any error. so I'm there when I send mail to the client, and when the client receives it and reads, at that time I received some kind of confirmation.

Please, if anyone has an idea, help me.

+5
source share
3 answers
<?php
/**
* Simple example script using PHPMailer with exceptions enabled
* @package phpmailer
* @version $Id$
*/

require ('../class.phpmailer.php');

try {
        $mail = new PHPMailer(true); //New instance, with exceptions enabled

        $body             = "Please return read receipt to me.";
        $body             = preg_replace('/\\\\/','', $body); //Strip backslashes

        $mail->IsSMTP();                           // tell the class to use SMTP
        $mail->SMTPAuth   = true;                  // enable SMTP authentication
        $mail->Port       = 25;                    // set the SMTP server port
        $mail->Host       = "SMTP SERVER IP/DOMAIN"; // SMTP server
        $mail->Username   = "EMAIL USER ACCOUNT";     // SMTP server username
        $mail->Password   = "EMAIL USER PASSWORD";            // SMTP server password

        $mail->IsSendmail();  // tell the class to use Sendmail

        $mail->AddReplyTo("someone@something.com","SOMEONE");

        $mail->From       = "someone@something.com";
        $mail->FromName   = "SOMEONE";

        $to = "other@something.com";

        $mail->AddAddress($to);

        $mail->Subject  = "First PHPMailer Message[Test Read Receipt]";

        $mail->ConfirmReadingTo = "someone@something.com"; //this is the command to request for read receipt. The read receipt email will send to the email address.

        $mail->AltBody    = "Please return read receipt to me."; // optional, comment out and test
        $mail->WordWrap   = 80; // set word wrap

        $mail->MsgHTML($body);

        $mail->IsHTML(true); // send as HTML

        $mail->Send();
        echo 'Message has been sent.';
} catch (phpmailerException $e) {
        echo $e->errorMessage();
}
?>

Some modification must be done above the script.

  • Configure SMTP mail server.

  • Set the correct FROM and FROM names ( someone@something.com , someone)

  • Set the correct TO address

of

also

+1
source

You can always add a response to the mailing address, which will take care that there is some kind of error, so you will receive an email, and if it is read, include the image (a blank image with 1 pixel) and add the code to this one, for example, and you can see how many hits this image really got or got at all.

0
source

, , "Disposition-Notification-To" , , . , , . ,

$email_header .= "Disposition-Notification-To: $from"; 
$email_header .= "X-Confirm-Reading-To: $from";

- , script , script , xxx , .

In fact, I can’t figure out how to confirm that it was delivered and not check it to read it, either by including the image requested from your server and registered as having access, or the link that the user must visit the full text messages.

It is also not guaranteed (not all email clients will display images or use HTML), and not all "delivered" messages will be read.

Although for more information https://en.wikipedia.org/wiki/Email_tracking

0
source

All Articles