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="">Here</a></body></html>'
var from_email = new helper.Email('');
var to_email = new helper.Email('');
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');

When the email arrives the following link appears:

Could someone help me solve this problem?


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 or have your GA on lock-down, this may not bother you.

Here’s more information on the feature in sendgrid:

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.

Answered By – swensor

Answer Checked By – Gilberto Lyons (AngularFixing Admin)

Leave a Reply

Your email address will not be published.