0

So I have some code //var urlPathReset = Request.Url.AbsoluteUri.ToString().Replace("RequestReset", "PasswordReset"); var urlPathReset = string.Format("{0}/{1}/{2}", passwordResetUrl, "resettoken", confirmationKey);

        var body = new StringBuilder();
        body.Append("A password reset has been requested for your account. ");
        body.Append("If you are the one who requested it, please click the link below to enter your new password. ");
        body.Append("If you did not request this reset, please ignore the email and your password will not be changed.");
        body.AppendLine();
        body.AppendLine();
        // PCSMYP-141 Now it's a link!  
        // It might be encoded, or there might need to be more changes
        body.AppendFormat("Password Reset Link: {0}", "<a Href=" + urlPathReset + ">Click here to reset password</a>)");
        emailQueue.Body = body.ToString();

Now the link should look something like this... Localhost:4xxx/urlPath but instead it looks something like.... enter image description here

I originally thought this would be okay--but this doesn't navigate to anything.

Any ideas?

Justin Le
  • 673
  • 1
  • 8
  • 24
  • My first thought was that this was encrypted in some way... and that it wasn't encrypting correctly because it was using the wrong localhost port address and then encrypting... But when we push to staging--it still is broken. so it is not an encryption issue/dev environment issue. – Justin Le Jun 09 '21 at 17:12

1 Answers1

0

So I believe this has something to do with sendgrid click tracking.... my final trick that ended up getting it to function was isntead of using href, i used and then included an empty string for the parameter. I thought it was clever.

body.AppendFormat("Password Reset Link: {0}", "<a data-target>" + urlPathReset + " " + "</a data-target>");
Justin Le
  • 673
  • 1
  • 8
  • 24