I have an array of email addresses and an array of passwords. I want to send each password to its corresponding email address(email at same index) in the body of email. But I don't want to use a loop. Is it possible to use substitution in the email body and then have sendgrid pick a value from the password array for each email address. I know I can construct a personalizations object like so :
personalizations: {to: [{email: "email1"}], substitutions: {"-pwd-": "pwd1"}}
and then use -pwd- in the body of email. But to construct this object I again have to use a loop which I don't want.
Haven't tried it out, but according to the SendGrid Docs it should be able.
The given example in the docs (for SendGrid API v3) looks the following way:
By using Dynamic Transactional Templates it should work the same way with handlebars.