Jump to content

Email Tracking


freakedout

Recommended Posts

Hi,

 

I have a php script that allows admin to send mail to users.

 

Now I need to add some code by which i can track how many times mail was opened or viewed etc

 

Is there any way to add some code of php etc that could track this

 

I had an idea of adding blank gif image to the mail but many mail programs blocks images so that will become useless

 

can anyone give some ideas how to do this.

 

 

Thanks in Advance

Link to comment
https://forums.phpfreaks.com/topic/87191-email-tracking/
Share on other sites

Hi adam,

i have gone thru' different forums and i got to know that this can be done using web beacons or by attaching 1x1 image in the html formatted mail.........But i am looking for an example code that would explain things easily. I tried implementing it myself. please lemme know where i am wrong....

 

 

trackEmail.php

 

<?php
// multiple recipients
$to  = '[email protected]'. ', '; // note the comma
$to .= '[email protected]';

// subject
$subject = 'Test mail for email tracking';

// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
   <tr>
     <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
   </tr>
   <tr>
     <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
   </tr>
   <tr>
     <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
   </tr>
</table>
<img src="trackImage.php">
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>

 

 

trackImage.php

<?php
echo "This is the image displayed";
?>

 

Link to comment
https://forums.phpfreaks.com/topic/87191-email-tracking/#findComment-445973
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.