Sendgrid事务邮件模板将href属性作为replace

我正在尝试使用sendgrid事务模板来发送信息电子邮件,如帐户validation等,使用sendgrid节点客户端 。 我创build了一个主要的事务模板,它应该有一个button,它具有一个dynamic的正文文本和一个带有每个邮件的dynamicURL / href属性的button。

我replacebutton文本的作品,如果我用URLreplacereplace它,我也看到在文本中的URL。 但是,当我尝试追加url到href属性它消失,它只是从我的锚标签剥离href属性。 这种情况在任何地方都会发生,无论是在可视化构build器中,HTML片段还是在邮件正文中设置buttonURL,都无关紧要。 手动设置一个URL,没有replace,似乎工作。

我也尝试使用%value%作为替代,和多个邮件客户端(Gmail,Outlook),但无济于事。请参阅我的函数发送以下信息电子邮件:

const sendInformationalEmail = async (to, subject, body, substitutions) => { const fromMail = new helper.Email(SENDGRID_FROM_MAIL); const toMail = new helper.Email(to); const content = new helper.Content('text/html', body); const mail = new helper.Mail(fromMail, subject, toMail, content); mail.setTemplateId(process.env.SENDGRID_INFORMATIONAL_TEMPLATE_ID); Object.keys(substitutions).map(substitution => { mail.personalizations[0].addSubstitution( new helper.Substitution(`-${substitution}-`, substitutions[substitution]) ); }); const request = sendgrid.emptyRequest({ method: 'POST', path: '/v3/mail/send', body: mail.toJSON() }); return await sendgrid.API(request, function(err, response) { console.log(response.statusCode); console.log(response.body); console.log(response.headers); }); }