Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const settings = require('../../settings');
- const nodemailer = require('nodemailer');
- const error = require('../util4geeks/errors');
- const Email = require('email-templates');
- var path = require('path');
- const i18n = require('i18n');
- const email = new Email({
- send: true,
- views: {
- root: path.join(__dirname, '..', 'templates')
- },
- transport: nodemailer.createTransport({
- host: settings.EMAIL_HOST,
- port: settings.EMAIL_PORT,
- secure: false, // true for 465, false for other ports
- auth: {
- user: settings.EMAIL_HOST_USER, // generated ethereal user
- pass: settings.EMAIL_HOST_PASSWORD // generated ethereal password
- }
- })
- });
- module.exports = {
- /**
- * Sends an Email with the Default SMTP settings
- * @param from
- * @param to
- * @param subject
- * @param template
- * @returns a Promise for the sending
- */
- sendEmailSMTP: (from, to, subject, template) => {
- email.send({
- template: template,
- message: {
- from: from,
- to: to,
- subject: subject
- },
- locals: {
- name: 'Luis'
- }
- });
- }
- };
Add Comment
Please, Sign In to add comment