Adding an unsubscribe link to a Magento newsletter template

Magento Commerce logo

A quick tip for Magento developer’s here, in how to add an unsubscribe link into a newsletter template so that the person can unsubscribe from the newsletter if they chose to do so.

Simply add {{var subscriber.getUnsubscriptionLink()}} into your template in order to output the link for the user to unsubscribe. This even works for people who aren’t registered customers of the Magento installation but that you’ve imported into your system as subscribing to the newsletter.

Full example of a link in your template to unsubscribe:

<a href=”{{var subscriber.getUnsubscriptionLink()}}” title=”Click here to unsubscribe from this newsletter”>Unsubscribe</a>

Share this with friends:

Like what you've just read? Share it to your friends using your favourite service below:

Share on Twitter Share on Facebook Share on Stumble Upon Share on Google Share on MySpace Share on Delicious Share on Digg Share on Google Buzz Share via Reddit Share via E-Mail Share via Wordpress.com Share via Tumblr Share via Posterous Share via Newsvine

Comments:

  1. This code snippet is already in the content field of newsletter template when you open a blank new template via Magento admin panel :)

  2. Hi.

    Is there any way to add a subscribtion link to emails sent out to customers (i.e. we want customers from old non-magento site to be able to subscribe with a single click instead of having to type in the URL and email address)…
    ?

    Regards,
    Jacob

  3. Hi Jacob,

    This would entirely depend on your situation, are you talking about sending old unsubscribe links to the new ones (redirection)?

  4. Just a question… I want to use mailchimp so that would mean the sending of mails will come from within mailchimp so I have an existing mailer (no unsubscription link in it) that i have pasted into mailchimp. Now mailchimp requires an unsubscription link and I cannot use that code can i as its local to magento? Or will it work?

  5. Gavin, do you mean that you want to be able to update your existing mailer when someone unsubscribes from the mailchimp link. So, unsubscribing from mailchimp also unsubscribes one from magento?

    If this is what you want to do, you can try using mailchimp’s webhooks. Find out more here http://www.mailchimp.com/api/webhooks/.

    Basically, when someone unsubscribes, you have mailchimp post some data to a url and run a script there. In this case, you will update some other database with the unsubscribe.

Add a Comment: