Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const nodemailer = require('nodemailer');
- module.exports = function({ props }) {
- return new Promise((resolve, reject) => {
- nodemailer.createTestAccount((err, account) => {
- let transporter = nodemailer.createTransport({
- host: this._config.host,
- port: this._config.port,
- secure: !!this._config.is_secure,
- auth: {
- user: this._config.auth.user,
- pass: this._config.auth.pass
- }
- });
- // setup email data with unicode symbols
- let mailOptions = {
- from: `"${this._config.sender}" <${this._config.auth.user}>`,
- to: props.reciver,
- subject: props.subject,
- [props.html ? "html" : "text"]: props.html ? this._data : props.data
- };
- transporter.sendMail(mailOptions, (error, info) => {
- if (error) {
- return reject(error);
- }
- resolve();
- });
- });
- });
- }
Add Comment
Please, Sign In to add comment