我想发送电子邮件给超过1个人,我的代码在node.js,我使用发送网格。当我用逗号分隔时,它不起作用。而且我希望电子邮件的内容采用html格式,知道html标签。
这些是我的代码
let html = "<b>"+"Hi John and Dee! </br>Someone needs help from a
CultureMee Consultant!</br>" + "Name: " +name + "</br>"+ "Email: "
+email+ "</br>"+ "Phone: " +phone +"</br>"+"Organisation:
"+organisation+"</b>"+ "How can you help: " +howCanWeHelp +"</br>"
+"Good luck!</b>"
//let html ="hello"
var helper = require('sendgrid').mail;
var from_email = new helper.Email(email);
var to_email = new
helper.Email("dee@culturemee.com,john@culturemee.com,mehrnoosh@lizard-
apps.com");
var subject = "There is a new CultureMee Consultant Application";
var content = new helper.Content('text/plain', html);
var mail = new helper.Mail(from_email, subject, to_email, content);
var sg = require('sendgrid')(process.env.SENDGRID_API_KEY);
var request = sg.emptyRequest({
method: 'POST',
path: '/v3/mail/send',
body: mail.toJSON()
});
sg.API(request, function (error, response) {
if (error) {
console.log('Error response received');
}
console.log(response.statusCode);
console.log(response.body);
console.log(response.headers);
});