简体   繁体   English

PHP Mailgun href 中的错误链接

[英]PHP Mailgun wrong link in 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.传递给电子邮件模板的变量使用了 2 次。

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/....).第一个(按钮 href)链接到电子邮件本身(email.mydomain.com/....)。

Why is this happening?为什么会这样? How can I fix it?我该如何解决?

There was a problem with mailgun. mailgun 有问题。 Mailgun was rewriting "hrefs" in my emails. Mailgun 在我的电子邮件中重写了“hrefs”。 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 的“问题”,这是您为域打开“点击跟踪”时的预期行为。

Mailgun only changes URLs in HREF attributes on HTML parts, but changes URLs found everywhere in plaintext parts. Mailgun 仅更改 HTML 部分的HREF属性中的 URL,但更改在纯文本部分中随处可见的 URL。 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>我最近用它来向我的用户显示一个新的 url,但跟踪他们的点击率: 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:基于 HTTP 的 API 允许您发送附加参数以覆盖单个电子邮件的默认打开和/或点击跟踪设置:

o:tracking - Toggles tracking on a per-message basis, see Tracking Messages for details. o:tracking - 在每条消息的基础上切换跟踪,有关详细信息,请参阅跟踪消息。 Pass yes or no .通过yesno

o:tracking-clicks - Toggles clicks tracking on a per-message basis. o:tracking-clicks - 在每条消息的基础上切换点击跟踪。 Has higher priority than domain-level setting.具有比域级别设置更高的优先级。 Pass yes , no or htmlonly .通过yesnohtmlonly

o:tracking-opens - Toggles opens tracking on a per-message basis. o:tracking-opens - 在每条消息的基础上切换打开跟踪。 Has higher priority than domain-level setting.具有比域级别设置更高的优先级。 Pass yes or no .通过yesno

You can manage this using the Mailgun Control Panel by setting o:tracking-opens and/or o:tracking-clicks params to false.您可以使用 Mailgun 控制面板通过将 o:tracking-opens 和/或 o:tracking-clicks 参数设置为 false 来管理它。 Also, changing the subdomain name can fix too.此外,更改子域名也可以解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM