2

In my store (Magento 2.4.1) I have the option for customers to subscribe to our Newsletter using Magento native newsletter module.

I use a thrid party service to send newsletter emails and I need to include the unsubcribe link in this emails. How can I get the unsubscribe link? is this a fixed link or does it change from customer to customer?

Thanks in advance !

2 Answers 2

3

With native Magento Newsletter extension you need to pass 2 arguments to unsubscribe action (id and code) and it's made by security reason to prevent unsubscribe any customer by email.

You can find source data in newsletter_subscriber table

You can share subscriber_id and subscriber_confirm_code into your 3rd party extension and generate a link using this 2 fields or use some another identifier(s) and create custom controller for unsubscribe

If you want to create your custom action you can find unsubscribe logic in \Magento\Newsletter\Controller\Subscriber\Unsubscribe

Native URL is /newsletter/subscriber/unsubscribe/id/{$ID}/code/{$CODE}

1
  • thanks for your help !
    – Joao71
    Jul 20, 2022 at 9:15
0

please try this in your template :

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

Your Answer

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

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