JD Isaacks
JD Isaacks

Reputation: 58014

PHPMailer: sending email....ask for a receipt?

I am going to create a script that sends out an email. I am currently using PHPMailer. I have been told that they would like the email to request a receipt from the user indicating they read it. (like what you often see in outlook). I have no clue if this is possible. Can anyone tell me if this is possible and if so how to do it?

Thanks!!

Upvotes: 2

Views: 11089

Answers (5)

marco
marco

Reputation: 29

I confirm as of today the correct method is doing:

$mail->addCustomHeader("Disposition-Notification-To: [email protected]");

Upvotes: 0

riotera
riotera

Reputation: 1613

See $ConfirmReadingTo in PHPMailer documentation

( More recent PHPMailer link on gitHub )

Upvotes: 7

Gyula Surmann
Gyula Surmann

Reputation: 81

You can use Josh’s recommendation with tracking image, but: - use a special folder name and custom image name with .GIF extension - track this image request by php handler, as an exception by accessing this non existing image - generate this custom image name into the email

For example:

<img src="http://www.yourdomain.com/email/abc34642.gif">

Your php exception handler detects, that you are requesting a gif image in the folder "email", which means, someone opened your email with the identification 34642. You have to find, which recepient has this id, and you can find the neccessary information. I recommend using a generated xml file to avoid too much database queries. Don’t forget to output a real image with gif header. This is absolutely safe against blocking your email with inappropriate image extension.

Upvotes: 1

Josh Curren
Josh Curren

Reputation: 10226

In PHPMailer you use $ConfirmReadingTo. You need to set it equal to the email address you want the confirmation sent to. Ex:

$ConfirmReadingTo: [email protected]

But some email clients (such as gmail) will just ignore this.

The best way to get a confirm from every email sent would be to send an HTML email and use a graphic to track which emails have been opened. The graphic source would be a script which you would let you check who has read the email. Ex:

<img src="http://www.yourSite.com/[email protected]&SUBJECT=The_Email_Subject" border="0" height="1" width="1">

emailConfirm.php could then generate an email to be sent to your email address.

Upvotes: 2

Jakub
Jakub

Reputation: 20473

I'm not sure if you can use them in PHP or not a quick search showed this:

Disposition-Notification-To: [email protected]

however they are not reliable in any way as most email clients either ignore them or just allow the user to hit 'cancel' to sending a reply. I've only really seen it used in corporate/enterprise type env with Notes or Outlook.

Just something to consider, but depends on your application.

Upvotes: 4

Related Questions