Node.js SendGrid Single Senderのテストメール送信
const sgMail = require('@sendgrid/mail');
// sgMail.setApiKey(process.env.SENDGRID_API_KEY);
sgMail.setApiKey('hogehoge');
const msg = {
to: 'hoge@hoge.com',
from: 'hoge@hoge.com',
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);
sgMail.send(msg).then(res => {
console.log(res);
}).catch(e => {
console.log(e);
});
APIキーは事前に作成していたものを使った。
メールきた
でもレスポンスに202が出た
202=acceptedってことで、sendgridに投げたけど結果は知らないって感じかな