I am building email templates for Sendgrid. Is there a way to insert an if statement in the template that checks for existence of the variables coming from the server and displays or hides the row that shows that variable in the email?
SendGrid uses HandleBars for dynamic templates. To conditionally render something, you can use:
{{#if user.profile.male}}
<p>Dear Sir</p>
{{else if user.profile.female}}
<p>Dear Madame</p>
{{else}}
<p>Dear Customer</p>
{{/if}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With