David Geismar
David Geismar

Reputation: 3422

SendGrid modifies links inside email and they dont redirect to correct page

I have a rails app running in production with sengrid. At one point in my app I am sending an email with a confirmation link which redirects to a specific confirmation page :

%a.button.button-custom.button-blue{href: confirm_votes_path(@vote.confirmation_token, only_path: false)

However in production, Sengrid seems to modify the link inside my mails. I get something like :

href="https://u3881616.ct.sendgrid.net/wf/click?upn=pVistOUxWTXmIPFqqAw0AnJt-2BbCLbreZ3xbCIcCjU0qXsxlkph8Wd3VafON-2FVyJfT0PWClbesX-2F2oOjnxeXwwaDA80aCKixoULvRGUX7PgDg59Vde4HU6spxlzuqyUUF_e4qGN2gUHpERWs59wU8LHyeuQCdWWdC4Yjpw10HvUcUonj0ZfIp-2FiYACT83qOqsHMBnkJGcBsjpIoSUjVySxVhEtqCz7myXFB-2B7uTWKruQbH-2BG7-2FI2-2BFdmXC6nbf-2FFpgyNUivvir0Upib8e5r8YJY3caF-2BpKD-2FscuINwBQkM7n008mEGADo5w5w5fejlzhopGHvJegbSRePJ-2BBu3b3olUhP2q-2BX4lyJAYvegG4xnDPU-3D"

and the link redirects to the base url of my website and not the good confirmation url like it does locally.

What is going on with SendGrid here

Upvotes: 13

Views: 12768

Answers (5)

Thiru Shan
Thiru Shan

Reputation: 1

If your website is https, and in which you have not enabled https in sendgrid, then you have to instruct the router to accept http as https... set the proxy which makes things to work

https://support.sendgrid.com/hc/en-us/articles/4412701748891-How-to-configure-SSL-for-click-tracking-using-CloudFront

Upvotes: 0

razvan.todea
razvan.todea

Reputation: 43

We encountered a similar issue, wherein the CNAME records for the branded link were absent from our domain provider's DNS settings.

To resolve this, we needed to insert a new CNAME record. We specified the HOST (url1234.ourdomain.com) and set the VALUE as 'sendgrid.net'

Upvotes: 0

Muhammad Shahryar
Muhammad Shahryar

Reputation: 90

It sounds like you might be encountering an issue with link tracking in SendGrid, which modifies links in outgoing emails to redirect through a tracking domain before forwarding to the original destination. This can sometimes cause issues if the link is already a local URL on your own site.

One solution is to disable link tracking for specific URLs in your emails by adding a clicktracking=false parameter to the link URL. For example, if your link URL is https://example.com/my-page/, you could modify it to https://example.com/my-page/?clicktracking=false.

Upvotes: 0

jacobmovingfwd
jacobmovingfwd

Reputation: 2273

What should the final URL look like? SendGrid is click-tracking, like bwest said, but that will still work with tokens in the URL and such. SendGrid does the substitution-variable replacement first, then tracks the resulting URL.

Upvotes: 1

bwest
bwest

Reputation: 9854

You need to disable click tracking.

Upvotes: 18

Related Questions