PHP Mailgun在href中的错误链接

I'm sending an activation email to newly registered users on my page. The mail arrives like it should and everything but I have on problem.

The variable that is passed to the email template is used 2 times.

First time on the button that activates you account:

   <a style="padding: 10px 20px; background-color: #A3D900; color: #ffffff;" href="<?php echo $activate_url; ?>"><b><?php echo __('Activate') ?></b></a>

And the second time under the button in normal text:

<p style="color:#333;">
    <?php echo $activate_url; ?>
</p>

The link is properly added only the second time. The first on (the button href) links to the email itself (email.mydomain.com/....).

Why is this happening? How can I fix it?

There was a problem with mailgun. Mailgun was rewriting "hrefs" in my emails. I disabled the link-tracking and now it works fine. I don't really need link tracking, since I'm tracking the activation page already.

This isn't a "problem" with Mailgun, it is the intended behavior when you have "Click Tracking" turned on for a domain.

Mailgun only changes URLs in HREF attributes on HTML parts, but changes URLs found everywhere in plaintext parts. I recently used this to show a new url to my users, but track their click-throughs: please sign in and update your bookmark to our new web address <a href="http://this.will.be.rewritten.by.mailgun">http://this.will.NOT.be.rewritten.by.mailgun.org</a>

The HTTP-based API allows you to send additional parameters to override the default open and/or click tracking settings for individual emails:

o:tracking - Toggles tracking on a per-message basis, see Tracking Messages for details. Pass yes or no.

o:tracking-clicks - Toggles clicks tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes, no or htmlonly.

o:tracking-opens - Toggles opens tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes or no.