List-Unsubscribe email header

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      = 'nobody@example.com';
		$subject = 'the subject';
		$message = 'hello';
		$headers = 'From: webmaster@example.com' . "\r\n" .
		    'Reply-To: webmaster@example.com' . "\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://domain.com/member/unsubscribe/?listname=espc-tech@domain.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.

Advertisements

3 thoughts on “List-Unsubscribe email header

  1. I am not completely sure how to add this to an outgoing gmail document. Do I enter that code into the document itself? I do not find a place to create header information in a gmail document.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s