Closed
Description
Issue Summary
I'm trying to use the substitution option with a transactional email template, the email is getting sent but the custom data for the substitution is not.
Here is my code
var helper = require('sendgrid').mail;
var from_email = new helper.Email(from);
var to_email = new helper.Email(to);
var subject = 'New Mentorloop notification';
var content = new helper.Content('text/html', text);
var mail = new helper.Mail(from_email, subject, to_email, content);
mail.setTemplateId("ea4f8a70-f487-49a3-b0ee-60b5848921e8");
var personalization = new helper.Personalization();
personalization.addTo( new helper.Email( from ) );
var substitution = new helper.Substitution("%text%", "Example User");
personalization.addSubstitution(substitution);
mail.addPersonalization(personalization);
var request = sendgrid.emptyRequest({
method: 'POST',
path: '/v3/mail/send',
body: mail.toJSON()
});
sendgrid.API(request, function(error, response) {
console.log(response.statusCode);
console.log(response.body);
console.log(response.headers);
});
Technical details:
- sendgrid-nodejs Version: lastest version
- Node.js Version: v4.7.0
Metadata
Metadata
Assignees
Labels
No labels