'@ sendgrid / mail'を使用して電子メールを送信する場合、 'to'フィールドはプレーンな電子メールアドレスのみを受け入れ、名前/電子メール形式は受け入れません(例:{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をありがとう!