Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i know if someone has opened an email?

I am working on an email system (PHP based) where hundreds of emails will be sent by the users and i want to track those emails so i will be able to know that email is opened or not ?

Can any one guide me how to do this ?

Thanks

like image 326
Naveed Metlo Avatar asked Dec 22 '13 12:12

Naveed Metlo


2 Answers

The only way I know of - and it's not very reliable - is to send an HTML mail in which you include something like:

PHP Code:

<img src='http://www.domain.com/mailcheck.php?user=123'>

image but in the process, you can track the GET user. You can also find a way to modifier the mail header so as to request a receipt - but I don't know how to do that - and it's also not reliable because of the voluntary nature of the request.

like image 196
Kiran RS Avatar answered Oct 12 '22 08:10

Kiran RS


Simple, you set up a PHP script that returns a 1x1 image. Have that script log the User-Agent and the IP (You can even log the referrer).

Now embed that in the email.

Since gmail has started showing the image always, but will host them from its own servers, you can although get to know if the mail is opened, but you might not be able to track the correct IP. Check some reference here: Effect of gmail caching and showing images by default

You can get to know how mailchimp does it: MailChimp Working

EDIT: Code reference:

<img src="http://www.example.com/checkopen.php?user_id=20" />

Inside the checkopen.php script, get the user_id field, now corresponding to this field, store it that this user has opened the mail.

While sending the mail, make sure you increment the user_id field everytime you send the mail.

So whenever this image is rendered, it will call the corresponding url and thus you can log into your system about the status of mail being opened.

like image 41
sushant-hiray Avatar answered Oct 12 '22 08:10

sushant-hiray