How to track a mail

When you send out a lot of mails its nice to know if they are opened or not. One way to do this is by using image tracking.

Say you put in a somewhat useless image into the mail

<img src="http://mydomain/open_register.png?user=1234">

On the mydomain server you would have to have a redirect in .htaccess like this:

RewriteEngine On
RewriteRule open_register.png open_mail_register.php [QSA,L]

The QSA (query string append) directive is important. It ask the apache server to append the query of the link to the php-file we open. This results in the total query:


In the file open_mail_register.php we could save the information that 1234 have opened the mail and then generate some rather useless graphics like this:

$user = $_GET['user'];

$im = imagecreatetruecolor(4, 4);
$c = imagecolorallocatealpha($im, 255, 255, 255, 127);
imagefill($im, 0, 0, $c);
header('Content-Type: image/png');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');

Now we are certain that the mail  was opened by 1234!

When you open mails from computerworld for instance this technique is applied, without the overhead of masking the .php as a .png. So its in use out there:

<img src=3D"
c1bb774cc86048faa25ef2d2265fb712" height=3D"1" width=3D"1">


Leder du efter billig vinduespudsning? Få et godt tilbud på billig vinduespudsning


Share thisShare on FacebookTweet about this on TwitterShare on LinkedInShare on Google+
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply