Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sendgrid change href of link

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('[email protected]'); var to_email = new helper.Email('[email protected]'); 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?

like image 375
rafaelcb21 Avatar asked Nov 18 '16 22:11

rafaelcb21


People also ask

What is click tracking in SendGrid?

Enabling Click Tracking causes all the links and URLs in your emails to be overwritten and pointed to either SendGrid's servers or the domain you branded your link with so that any time a customer clicks a link, SendGrid can track those clicks. SendGrid can track up to 1000 links per email.

How do I send an HTML email in SendGrid?

Email template with HTML codeClick “Download Template,” and we'll send you a copy of the HTML code to your inbox. You can then copy/paste the code into your email design editor to import the template and tailor it to your brand and campaign.


1 Answers

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.

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.

UPDATE: Whitelabeling in Sendgrid

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.

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.

like image 124
swensor Avatar answered Sep 28 '22 00:09

swensor