use PHP to know if sent email has been opened

2

I am very curious to know how I know if the email I sent was opened by the recipient. Is there any way to tell using PHP or some other language?

    
asked by anonymous 03.04.2015 / 01:10

1 answer

6

Disposition-Notification-To

What I recommend you do is add this to the header of your email:

Disposition-Notification-To: [email protected]

This is basically a request to the email client so that you receive a viewing confirmation as soon as the email is opened. The recipient can, of course, turn off sending this notification.

Web Bugs

You can do this by using an invisible image in the body of the email that calls a php script on your server, or at the suggestion of @ Bacco , take advantage of a legitimate e-mail image (logo, footer, etc.):

<img src="http://seusite.com.br/email_track.php?msgId=01abc02"/>

Sointhescriptyoudosomethinglike:

if($_GET["msgId"] ) {
    $query = "update sent_mail set visualized_flag = 1 where mail_id = :id";
    $stmt = $conn->prepare($query);

    $stmt->bindParam(":id", $_GET["mailId"]);

    $stmt->execute();
    ...
}

But this practice is strongly discouraged, and most e-mail clients (including web clients) block such external content and are not good practice.

In addition, you can search for some WebServices that do this, such as Get Notify .

    
03.04.2015 / 01:37