SendGrid : How to set dynamic link value of a button

Viewed 4350

I am using sendGrid to send an email verification mail to a user, when user click on a "Verify" button it will be redirected to another link, I have successfully sent an email but I can't figure out how can I make button dynamic?

I read about substitution and don't know how to use this with button I have added following line to my code

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

And this is my Button code on SendGrid

<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>

What should I write in href?

1 Answers

Just in href attribute put {{variable}}. Like this : Verify . Take into account that {{variable}} is the name of the field you are receiving.

Related