Search code examples
mailgun

Skip automatic "Unsubscribe Me" feature for just one e-mail transaction


I have a mailgun account and have been using it to send e-mails. I've enabled the automatic "Unsubscribe Me" feature that makes it so that all e-mails sent from my account would have the "Unsubscribe" link.

However, I have an e-mail that I would like to get sent only once and would like to disable the unsubscribe me feature for this one particular e-mail.

How do I turn off the unsubscribe me feature for a specific e-mail send out only and not having to result to turning the feature off completely?


Solution

  • The best way to achieve this is to take advantage of the modularity of Mailgun when it comes to adding domains.

    Given your example, if you own say, domain.com you can create a subdomain news.domain.com or any similar subdomain name.

    Disable the footer for that subdomain here:

    https://mailgun.com/cp/unsubscribes?domain=news.domain.com

    Once that's done send an email using that subdomain rather than your full-domain.

    Advantages are that you keep control of your footer without any complicated code related steps and the fact that emails are still coming from your domain thus all the deliverability metrics linked to your domain and IP remain the same.

    For example from the commandline

     curl -s --user 'api:key-apikeyapikey' \
        https://api.mailgun.net/v2/NEWS.domain.com/messages \
        -F from='[email protected]' \
        -F [email protected] \
        -F subject='Hello' \
        -F text='Testing some Mailgun awesomness!'