Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add an unsubscribe link in a single email with Mailgun using SMTP?

Tags:

mailgun

I am having trouble figuring out how to put an unsubscribe link in my email that is SMTP integrated with Mailgun.

Any thoughts?

like image 775
Wes Ferrell Avatar asked Nov 03 '16 19:11

Wes Ferrell


2 Answers

Mailgun provides you with several unsubscribe variables:

1) %unsubscribe_url% -- link to unsubscribe recipient from all messages sent by given domain

2) %tag_unsubscribe_url% -- link to unsubscribe from all tags provided in the message

3) %mailing_list_unsubscribe_url% -- link to unsubscribe from future messages sent to a mailing list

If you include these variables in your emails, any recipient that clicks on the url will be automatically unsubscribed and those email addresses will be blocked from receiving future emails from that domain or message tag as appropriate.

reference https://documentation.mailgun.com/user_manual.html#tracking-unsubscribes

like image 166
Amit Gupta Avatar answered Sep 28 '22 01:09

Amit Gupta


You can use it in a href link:

<a href="%unsubscribe_url%" target="_blank">Click here to unsubscribe</a>

like image 24
Jonathan Pagani Avatar answered Sep 28 '22 02:09

Jonathan Pagani