Currently, Mailgun doesn't support HTTPS tracking links officially. Not to worry though, as there is a workaround! It does require the use of a CDN and we recommend utilizing CloudFlare, however, most CDN's should suffice.
Why do I need a CDN?
To understand why the use of a CDN is required for HTTPS tracking links, a quick, high level overview of how they work is needed. Tracking links work by utilizing a CNAME that points to mailgun.org. Links in your email messages are then rewritten with this tracking hostname. When your recipients then click on those links, it first sends the request to mailgun.org and we return a redirect to the original URL.
Since we do not support HTTPS connections to mailgun.org, a CDN is needed to fill the gap between the client and mailgun.org. Essentially, the client connects to the CDN via HTTPS, the CDN connects to mailgun.org via HTTP, and the CDN serves the response from mailgun.org to the client over HTTPS.
The following are the specific steps for setting up CloudFlare as a CDN to handle Mailgun tracking links to support HTTPS.
Step 1 Create a CNAME
In your CloudFlare account, click on the DNS option and configure a new CNAME entry that points your Mailgun Tracking CNAME (e.g., email.your-domain.com) to mailgun.org. Ensure that the CNAME is configured as DNS and HTTP Proxy (CDN). The cloud image under Status should be the color orange.
Step 2 Create a Page Rule
Navigate to the Page Rules settings for your domain and create a Page Rule for your Tracking CNAME (i.e., email.your-domain.com) that sets SSL to Flexible. Make sure to use a wildcard after your domain for the best results (e.g., https://email.your-domain.com/*). Then, turn this On.
Step 3 Create a Support Ticket
Once the above 2 steps are done, create a support ticket via the Mailgun Control Panel to let us know. We will then set your links to default to HTTPS instead of HTTP.
Note: CloudFlare's default universal SSL certificate only supports root and 1st level subdomains. If your tracking hostname is a 2nd level domain or higher, you'll need to contact CloudFlare to discuss your options for an SSL certificate to support the tracking hostname.