We are using gmail, yahoo, hotmail etc to send emails to our friends, relatives etc. We dont know whether the email that we sent was read by the recipient or not. To get the read receipts, we need paid accounts from the Mail providers.
Here i am going to show you a simple php program script to get read receipts of the emails that we sent.
$user_id = $_GET['user_id'];
If ( $user_id )
$FileName = $id.".txt";
$ourFileHandle = fopen($FileName, 'w') or die("can't open file");
$to = "email@example.com"; //to address
$subject ="Read Receipt Email";
$message = "Testing whether the read receipt script works or not";
$message = " $headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$headers .= 'From: firstname.lastname@example.org' . "rn";
if (mail($to, $subject, $message, $headers) )
echo "Mail sent successfully";
echo "failed to send mail";
Now the user_id parameter contains a When you open this page (http://www.example.com/email.php) on the browser, then the script first tries to read the get parameter user_id and checks whether there is any value in the parameter.
- As there is no value for the user_id parameter, the script goes to the else part and sends an email to the user. The important part here is the image tag in the message.
- Once the user receives an email and opens it, the html image tag tries to download a zero pixel image from the site. The url of the image is http://email@example.com value. The php script goes to the section and creates an empty file with firstname.lastname@example.org. The creation of the empty file indicates that the user read the email.
- July 24,2016