Yes, Transactional Email provides an easy-to-use merge tag to automatically add an unsubscribe link to your Transactional Email emails. The merge tag consists of the word UNSUB, followed by a colon, and then a full website address (with http:// or https://) where recipients are redirected when the unsubscribe is processed:
If a recipient clicks the generated link, the message status changes to Unsubscribed and the recipient's address is added to the Rejection Blacklist in your Transactional Email account. The redirect URL will be appended to include two query string parameters that can be used for processing the unsubscribe in your own system or database:
- md_id: The _id, as provided in the API call and webhooks of the specific message where the unsubscribe link was clicked
- md_email: A URL-encoded and obfuscated version of the recipient's email address. If displayed, the email is shown using the format X****@x***.***.
In order to use the email address for further processing in your system, you can use the rules engine and webhooks to identify the unsubscribe email address. For more information, see Rules Engine and Webhooks.
Using the unsub merge tag
The unsubscribe merge tag generates only the URL to unsubscribe and can be used in both HTML and text emails. In HTML, you might construct the link like this to create a clickable link for recipients to unsubscribe:
<a href="*|UNSUB:http://mywebsite.com/unsub|*">Click here to unsubscribe.</a>