UNPKG

@mathrunet/masamune

Version:

Manages packages for the server portion (NodeJS) of the Masamune framework.

57 lines 2.18 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.send = send; const mail_1 = __importDefault(require("@sendgrid/mail")); /** * Send mail through SendGrid. * * SendGridでメールを送信します。 * * @param {string} process.env.MAIL_SENDGRID_APIKEY * API key for SendGrid. Issue it according to the following procedure. * https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c * SendGridのAPIキー。下記の手順で発行します。 * https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c * * @param {string} from * Sender's email address. * 送信元メールアドレス。 * * @param {string} to * Email address to be sent to. * 送信先メールアドレス。 * * @param {string} title * Email Title. * メールタイトル。 * * @param {string} content * Email content. * メール本文。 */ function send(_a) { return __awaiter(this, arguments, void 0, function* ({ from, to, title, content, }) { var _b; mail_1.default.setApiKey((_b = process.env.MAIL_SENDGRID_APIKEY) !== null && _b !== void 0 ? _b : ""); const msg = { to: to, from: from, subject: title, text: content, }; yield mail_1.default.send(msg); }); } //# sourceMappingURL=send_grid.js.map