sendgrid-nodejs: Substitution is not working
Issue Summary
I migrated from sendgrid 2.0.0 to @sendgrid/mail 6.1.2, the substitutions are not working anymore
Steps to Reproduce
SendgridService.prototype.sendTestEmail = function () {
var text = 'Hi %DISPLAY_NAME%\n\n'
const msg = {
to: 'xxx@gmail.com',
subject: 'Test Email',
from: {email: 'no-reply@example.com', name: 'Test'},
text: text,
substitutions: {
"%DISPLAY_NAME%": 'Test'
}
}
return sendgrid.send(msg)
}
Technical details:
- sendgrid-nodejs Version: master (latest commit: [commit number])
- Node.js Version: 8.4.0
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (11 by maintainers)
@sydneyhenrard,
For helping us solve this issue, we would like to send you some swag as a token of our gratitude.
Thanks for supporting SendGrid!
With Best Regards,
Elmer
If I use camelCase variable, I have no problem with the substitutions even for substitution 0
Merged as v6.1.3, thanks @adamreisnz!
I think I may know what the problem is, let me investigate.
@thinkingserious
Please ignore my previous comment. After your reply I went back to look at it with fresh eyes and it was an extra space in the interpolated variable that was causing the issue which I didn’t catch the first time.
All is working as advertised. Thank you.
#442 should fix this 👍