Magento – How to add unsubscribe link in custom email template magento1

email-templatesmagento-1.9

I want to add unsubscribe link in the custom email template. I am using code:

<a href="{{var subscriber.getUnsubscriptionLink()}}"><strong>Unsubscribe</strong></a>

But it is not working, can anybody help to do this?

Best Answer

You need to create custom variable and use in the custom email template. for example:

$unsubscribeUrl = Mage::getModel('newsletter/subscriber')->loadByEmail($email)->getUnsubscriptionLink();
$vars = array('quote' => $quote, 'url' => $url, 'customunsubscribeurl' => $unsubscribeUrl);

Now, You can use "customunsubscribeurl" in custom email template.