Is there a out-of-the-box way of including an unsubscribe link in transactional emails inside of Magento 2?

I tried utilizing:

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

Which is used in the email newsletter templates but this does not work inside of a transactional email.

  • Is this new order email? May 2, 2017 at 1:24
  • No, I'm trying to include an unsubscribe link inside the subscription confirmation email to keep a client compliant in their country's electronic communication laws. Something along the lines of "You can unsubscribe at anytime using the following link".
    – Eirik
    May 2, 2017 at 3:36
  • Create object of Magento\Newsletter\Model\Subscriber & call getUnsubscriptionLink function
    – Jackson
    May 2, 2017 at 9:10
  • @AnkitShah, I have tried the same that you have mentioned and then I got the unsubscription link in mail. The unsubscription process was working fine. But the probelm is it return "You have logged out." success message. How can I solve that?
    – Ramya
    Apr 13, 2020 at 12:39
  • This {{var subscriber.getUnsubscriptionLink()}} works only in Newsletter Queue emails. I need in the Newsletter Subscription success email to add unsubscribe link but this <a href="{{var subscriber.getUnsubscriptionLink()}}">Unsubscribe</a> is not working Anyone find a solution to this?
    – axel
    Apr 16, 2020 at 16:15

1 Answer 1


it's working for me.

<a href="{{var subscriber.getUnsubscriptionLink()}}">Unsubscribe</a>
  • how to add subscribe link?
    – Manjunath
    Apr 1, 2020 at 7:54
  • This answer only works for Newsletter emails, not the success email that the question is asking about.
    – Tobe_Sta
    Jun 17, 2021 at 3:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.