2

Possible Duplicate:
PHP: Check who had read sent email?

I'm writing a tool in PHP that will be sending notifications to members using mail(). Is there a way to get a notification when an email has been opened by recipient? Granted some systems do not support that but for those that do, how can I do that?


UPDATE:

Tested different ways. The best seem to have 1x1 image included. Avoid including logos and other images. They look quite ugly when blocked. 1x1 seem to have too small of an area to show security warning when blocked.

Community
  • 1
  • 1
santa
  • 12,234
  • 49
  • 155
  • 255
  • 1
    Probably the same question: http://stackoverflow.com/questions/4603850/php-check-who-had-read-sent-email – Till Helge Oct 28 '11 at 14:59
  • Are you sure you want to spend time on something that will probably only work on a miniscule amount of cases? Unless you are mainly targeting users of a system you know has such support. – Jon Oct 28 '11 at 14:59
  • Perfect, the other discussion covered it all. Somehow I missed it. – santa Oct 28 '11 at 15:04

4 Answers4

1

The request is made in the email by adding an optional header to the message, like this: Disposition-Notification-To: sendReceiptToAddress

Just add something like this as one of the headers for the mail message:
$headers .= "Disposition-Notification-To:\r\n";

Also, if this is an HTML formatted email (and you have a web server to handle the requests), you could add a request to a PHP script that will return a 1x1 transparent tracking pixel to the email body itself, with a URL like:
http://mydomain.com/emailtracker/track.php?message=MyMsgId&user=MyUserId

This isn't 100% either, since people usually have the option not to download images for an email.

John S
  • 79
  • 2
0

You could add an image with a unique id. Once the image is loaded you know the mail was opened (The image could actually be a script).

The problem with this is, that most clients do not load images in html mails on their own to protect privacy. The recipient has to authorize this first.

Another way would be to request a reading notification (which the recipient has to authorize too) - This would be send to the email address specified by From or Return-Path.

Hikaru-Shindo
  • 1,891
  • 12
  • 22
0

I don't think it's possible in PHP.

Even using an image e.g. <img src="http://yourdomain.com/received_mail.php?id=mail_id"?> wouldn't work if the email client blocked images.

You could try adding the Disposition-Notification-To:your@email.com header to receive and alert using your mail server and then if it's received mark the message as read.

Tom
  • 33,626
  • 31
  • 85
  • 109
Peter
  • 16,453
  • 8
  • 51
  • 77
  • If the email client is blocking images, then you can track a link inside the email to check if someone has opened the message. This is how MailChimp and Campaign Monitor are able to track open rates for text based emails. – Tom Oct 28 '11 at 15:04
  • I have links in email. How do I track them to check if the email has been openned? – santa Oct 28 '11 at 15:17
  • I think it's not possible :) Maybe Tom mean track `click from links`. Sorry for my english, and thx Tom for review – Peter Oct 28 '11 at 15:36
  • Yep, I can't edit my comment :( – Tom Nov 15 '11 at 12:32
0

If you think the user will click a link in your email before downloading an image you can have your links redirect through a tracking page you set up to keep track.

finny
  • 16