Jump to content

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  = 'ex@ex.com'. ', '; // note the comma
$to .= 'ex@ex.com';

// 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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.