SendGrid:如何设置按钮的动态链接值

问题描述 投票:1回答:1

我正在使用sendGrid向用户发送电子邮件验证邮件,当用户点击“验证”按钮时,它将被重定向到另一个链接,我已经成功发送了一封电子邮件,但我无法弄清楚如何使按钮动态化?

我读了关于substitution并且不知道如何使用这个按钮我已经在我的代码中添加了以下行

 email.addSubstitution(VERIFY_TOKEN_KEY, new String[] { token.getToken() });

这是我在SendGrid上的Button代码

<a style="background-color:#51a9a4;border:1px solid #333333;border-color:#333333;border-radius:6px;border-width:1px;color:#ffffff;display:inline-block;font-family:arial,helvetica,sans-serif;font-size:16px;font-weight:normal;letter-spacing:0px;line-height:16px;padding:12px 18px 12px 18px;text-align:center;text-decoration:none;"
  href="-verifyLink-" target="_blank">Verify</a>

我应该在href写什么?

java html button sendgrid substitution
1个回答
0
投票

只需在href属性中放置{{variable}}。像这样:验证。请注意{{variable}}是您收到的字段的名称。

© www.soinside.com 2019 - 2024. All rights reserved.