Is it possible to send an email through Sendgrid without a subject? I tried leaving the subject field blank, but I get an error message that says
TypeError: Cannot read property 'map' of undefined
Here is my code...
var helper = require('sendgrid').mail;
var fromEmail = new helper.Email("myemail@email.com");
var toEmail = new helper.Email("sendEmail@email.com");
//I set the subject to null
var subject = null;
var content = new helper.Content('text/html', "my message");
var mail = new helper.Mail(fromEmail, subject, toEmail, content);
var sg = require('sendgrid')('-----------------');
var request = sg.emptyRequest({
method: 'POST',
path: '/v3/mail/send',
body: mail.toJSON()
});
sg.API(request, function (error, response) {
});
I tried setting the subject to null
and "";
but both returned error messages.
Any Ideas?