是否可以通过 Sendgrid 发送没有主题的电子邮件?我尝试将主题字段留空,但我收到一条错误消息,内容为
TypeError: Cannot read property 'map' of undefined
这是我的代码...
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) {
});
我尝试将主题设置为null
,"";
但都返回了错误消息。
有任何想法吗?