Home » Php » email – Delivery reports and read receipts in PHP mail

email – Delivery reports and read receipts in PHP mail

Posted by: admin April 23, 2020 Leave a comment

Questions:

Does anyone of you know off by hand what mail headers to add in order to get a read receipt and delivery report? This now being when you use the normal PHP mail function. No fancy add-on script / class like phpMail.

How to&Answers:

For the reading confirmations:

You have to add the X-Confirm-Reading-To header.

X-Confirm-Reading-To: <address>

For delivery confirmations:

You have to add the Disposition-Notification-To header.

For usage details see RFC 3798.


General tip for stuff like this:

Use the mail client of your choice to generate an e-mail with the desired parameters, send it to yourself and look at the mail source.

There you can find the necessary headers added by the feature you are looking for. Then read the RFC or google for specific details on the header in question.

Answer:

Gmail blocks methods such as:

img src=”http://yourdomain/tracking.php?id=EMAIL_ID” width=”0″ height=”0″

This is because the image is retrieved from a proxy. Since the URL contains variables and not a real image file, the image will not be shown. The tracker would be useless.

I’ve personally experienced this as I build my own newsletter system.

Answer:

What you could also do is embed an img (assuming that you’re sending the email as text/html) tag that has in its source the following:

<img src="http://yourdomain/tracking.php?id=EMAIL_ID" width="0" height="0" >

where tracking.php is a file that would be opened when the email is also opened (assuming images are activated) and then you can catch on your side the parameter id and check it against a stored id (database or file).

I am doing this for a newsletter manager to count the number of views.

Answer:

X-Confirm-Reading-To: Disposition-Notification-To: or Return-Receipt-To: