使用“@sendgrid/mail”发送任何电子邮件时,“收件人”字段仅接受普通电子邮件地址,不接受姓名/电子邮件格式(例如:{name:'John Doe', email:'[email protected]'} )。
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: { email:'[email protected]', name: 'John Doe' },
from: '[email protected]',
subject: 'Sending with SendGrid is Fun',
text: 'and easy to do anywhere, even with Node.js',
html: '<strong>and easy to do anywhere, even with Node.js</strong>',
};
sgMail.send(msg);
嘿@thinkingserious ,谢谢你。 我在文档中错过了这个,工作正常:)
感谢跟进@agostonbonomi!