Sendgrid更改链接的href [英] Sendgrid change href of link

查看:123
本文介绍了Sendgrid更改链接的href的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Nodejs与Express结合使用,并且正在通过Sendgrid发送电子邮件,但是Sendgrid正在更改href链接

I am using Nodejs with Express and I am sending an email through Sendgrid, but Sendgrid is changing the href link

var emailText = '<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body><a href="https://www.google.com">Here</a></body></html>'
var from_email = new helper.Email('contact@test.com');
var to_email = new helper.Email('contact@test2.com');
var subject = 'Test';
var content = new helper.Content("text/html", emailText)
var mail = new helper.Mail(from_email, subject, to_email, content);                                            
var request = sg.emptyRequest({
    method: 'POST',
    path: '/v3/mail/send',
    body: mail.toJSON(),
});
sg.API(request, function(error, response) {
    if (error) {
        console.log('Error response received');
    }
    console.log(response.statusCode);
    console.log(response.body);
    console.log(response.headers);
});

电子邮件到达时,将出现以下链接:

When the email arrives the following link appears:

https://u4006412.ct.sendgrid.net/wf/click?upn = rOQ9fjZGp5r0JyNfoC02LbL .....

有人可以帮我解决这个问题吗?

Could someone help me solve this problem?

推荐答案

我相信这是由URL点击跟踪功能引起的sendgrid。它会重定向到您想要的资源,但看起来并不漂亮。您可以在sendgrid中将其关闭,但是它将禁用该帐户发送的所有电子邮件的URL跟踪。如果您正在与诸如bit.ly之类的第三方链接跟踪器集成,或者您的GA处于锁定状态,这可能不会打扰您。

I believe this is caused by the URL click-tracking feature of sendgrid. It will redirect to your intended resource, but does not look pretty. You can turn it off in sendgrid, but it will disable URL tracking on all emails sent by that account. If you are integrating with a 3rd-party link-tracker such as bit.ly or have your GA on lock-down, this may not bother you.

有关此功能的更多信息sendgrid: https://sendgrid.com/docs/User_Guide/Settings/tracking.html

Here's more information on the feature in sendgrid: https://sendgrid.com/docs/User_Guide/Settings/tracking.html

将其关闭,查看您的电子邮件外观。

Turn that off and see how your emails look.

Sendgrid还具有白标功能,使您可以从一个子域中提供URL,同时仍通过其服务器跟踪点击/打开。如果您从UX的角度考虑链接的美观性或可感知的安全性,则可以采用这种方式。

Sendgrid also has a whitelabeling feature, allowing you to serve URLs from one of your subdomains while still tracking clicks/opens through their servers. If you are concerned about the prettiness of your links or perceived security from a UX perspective, this may be the way to go.

查看其白标签概述
链接白色标签文档页面。确保遵循sendgrid关于电子邮件中域使用的建议。这样可以确保较高的交付成功率。

Check out their overview of whitelabeling and link whitelabeling doc pages. Be sure to follow sendgrid's recommendations on domain usage in emails. This ensures a high success rate on delivery.

这篇关于Sendgrid更改链接的href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆