プレイグラウンド、サンドボックス、使い捨てスクリプト置き場
0

Configure Feed

Select the types of activity you want to include in your feed.

add sendgrid example

Kohei Watanabe (Aug 23, 2023, 10:46 AM +0900) a115c1a9 8d6c754b

+21
+21
nodemailer/sendgrid.mjs
··· 1 + import nodemailer from "nodemailer"; 2 + 3 + // see https://support.sendgrid.kke.co.jp/hc/ja/articles/204187885-SMTP%E3%81%AE%E6%8E%A5%E7%B6%9A%E6%83%85%E5%A0%B1%E3%82%92%E6%95%99%E3%81%88%E3%81%A6%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84- 4 + const transporter = nodemailer.createTransport({ 5 + host: "smtp.sendgrid.net", 6 + port: 465, 7 + secure: true, 8 + auth: { 9 + user: "apikey", 10 + pass: "SG.****", // https://app.sendgrid.com/settings/api_keys > Create API Key > Mail Send > Custom Access > Mail Send 11 + }, 12 + }); 13 + 14 + const info = await transporter.sendMail({ 15 + from: "foo@example.org", 16 + to: "bar@example.org", 17 + subject: "Hello world!", 18 + html: "<marquee>Hello world.</marquee>", 19 + }); 20 + 21 + console.log(info.messageId);