我正在使用电子邮件服务,但链接在某种程度上被混淆了,无法正常工作

dgiusagp  于 2021-09-29  发布在  Java
关注(0)|答案(1)|浏览(376)

所以我有一些代码//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();

现在链接应该是这样的。。。localhost:4/urlpath,但它看起来像。。。。

我原本以为这没问题,但这并没有指向任何东西。
有什么想法吗?

raogr8fs

raogr8fs1#

所以我相信这与sendgrid点击跟踪有关。。。。我的最后一个技巧是不使用href,我使用了,然后为参数包含了一个空字符串。我认为这很聪明。

body.AppendFormat("Password Reset Link: {0}", "<a data-target>" + urlPathReset + " " + "</a data-target>");

相关问题