PHP Mailgun在href中的错误链接

邮件到达时应该和所有内容一样 但我遇到了问题。</ p>

传递给电子邮件模板的变量被使用了2次。</ p>

第一次激活你的按钮 帐号:</ p>

 &lt; a style =“padding:10px 20px; background-color:#A3D900; color:#ffffff;”  href =“&lt;?php echo $ activate_url;?&gt;”&gt;&lt; b&gt;&lt;?php echo __('Activate')?&gt;&lt; / b&gt;&lt; / a&gt; 
</ code > </ pre>

第二次在普通文本按钮下:</ p>

 &lt; p style =“color:#333;”&gt  ; 
&lt;?php echo $ activate_url; ?&gt;
&lt; / p&gt;
</ code> </ pre>

此链接仅在第二次正确添加。 第一个(按钮href)链接到电子邮件本身(。</ p>

为什么会发生这种情况? 我该如何解决?</ p>
</ div>



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; ?>

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

Why is this happening? How can I fix it?

duanhua5523 对不起,有点忘了这个问题。现在回答。
5 年多之前 回复
duanjian4331 你把它整理出来了吗?我在这里遇到了同样的障碍。
5 年多之前 回复


mailgun出现问题。 Mailgun正在重写我的电子邮件中的“hrefs”。 我禁用了链接跟踪,现在它工作正常。 我真的不需要链接跟踪,因为我已经跟踪了激活页面。</ p>
</ div>



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.

dongshan8953 同样的问题,但链接跟踪禁用不起作用。 你做了别的什么吗?
大约 5 年之前 回复

这不是Mailgun的“问题”,当您为域启用“点击跟踪”时,这是预期的行为 。</ p>

Mailgun仅更改HTML部件上 HREF </ code>属性中的URL,但更改了明文部分中到处找到的URL。 我最近用这个来向我的用户显示一个新网址,但跟踪他们的点击次数:请登录并将您的书签更新为我们的新网址&lt; a href =““&gt;< / a&gt; </ code> </ p>

HTTP- 基于API的API允许您发送其他参数以覆盖各个电子邮件的默认打开和/或点击跟踪设置:</ p>

o:tracking </ em> - 切换每个电子邮件的跟踪 -message basis,请参阅跟踪消息以获取详细信息。 通过是</ strong>或否</ strong>。</ p>

o:tracking-clicks </ em> - 切换点击跟踪 信息基础。 具有比域级别设置更高的优先级。 通过是</ strong>,否</ strong>或 htmlonly </ strong>。</ p>

o:tracking-opens </ em > - Toggles基于每条消息打开跟踪。 具有比域级别设置更高的优先级。 通过是</ strong>或否</ strong>。</ p>
</ div>



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=""></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.

Csdn user default icon