UNPKG

notification-services

Version:

Use email, sms and custom notification services for node.js application easily

30 lines (29 loc) 904 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.sendmailSend = exports.sendmailConfig = void 0; const nodemailer_1 = __importDefault(require("nodemailer")); let transporter; const sendmailConfig = (path, newline) => { transporter = nodemailer_1.default.createTransport({ sendmail: true, newline, path }); }; exports.sendmailConfig = sendmailConfig; const sendmailSend = (mailOptions, callback) => { transporter.sendMail(mailOptions, (err, info) => { if (err) { callback(null, err); return; } callback({ envelope: info.envelope, messageId: info.messageId }, null); }); }; exports.sendmailSend = sendmailSend;