If you are sending newsletter regularly, you always put a link in your template to named “To unsubscribe from this mailing link – click here” such that user can unsubscribe himself by following the unsubscribe link. A new header is introduced to have this facility on header.
So if you put the unsubscribe header on your mail, you unsubscribe button will be appeared on the email. All mail client doesn’t support this feature, i saw this already in gmail and hotmail. Hope other client will support this soon. You have to add lis-unsubscribe header with a mailto link for unscribe email, along with unsubscribe link to your site – see the following example –
$to = 'firstname.lastname@example.org'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: email@example.com' . "\r\n" . 'Reply-To: firstname.lastname@example.org' . "\r\n" . 'List-Unsubscribe: <mailto:unsubscribe-espc-tech-12345N@domain.com>' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(mail($to, $subject, $message, $headers)) echo 'Mail sent';
Above example will work on gmail only. On gmail you will see extra link – click to unsubscribe. so if recepient click on that link – gmail will send an email to that email. To make this workable for windows live, change the list-unsubsribe header to
'List-Unsubscribe: <http://email@example.com?id=12345N> ' . "\r\n" .
so an extra button will come up, if you click on that button – a new window will appear with unsubscribe link on your site.
It’s an interesting feature, Love it.