How to use the nodemailer.createTransport function in nodemailer

To help you get started, we’ve selected a few nodemailer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skagitpublishing / connextCMS / private / nodemailer-service / app.js View on Github external
var email = request.query.email;
  var subject = request.query.subject;
  var message = request.query.message;
  
  var responseMessage = "<p>Success!<br>" +
      "You've sent the text: <br>"+
      "email: "+email+"<br>"+
      "subject: "+subject+"<br>"+
      "message: "+message+"<br></p>";
  
  response.send(responseMessage);
  
  debugger;
  
  //Send the info along to gmail to transmit the email using NodeMailer.
  var transporter = nodemailer.createTransport({
      service: 'gmail',
      auth: {
          user: gmail_username,
          pass: gmail_password
      }
  }, {
      // default values for sendMail method
      from: gmail_from,
      //headers: {
      //    'My-Awesome-Header': '123'
      //}
  });
  transporter.sendMail({
      to: email,
      subject: subject,
      text: message
github codeforgeek / mass-mailer-nodejs / Server.js View on Github external
function massMailer() {
	var self = this;
	transporter = nodemailer.createTransport("SMTP",{
	    host: 'smtp.gmail.com',
	    port: 587,
	    auth: {
	        user: '',
	        pass: ''
	    },
    	    tls: {rejectUnauthorized: false},
    	    debug:true
	});
	// Fetch all the emails from database and push it in listofemails
	self.invokeOperation();
};
github npm-install / summaries.io / functions / index.js View on Github external
function sendEmail(user, html) {
  const { gmail } = require('./keys')
  var transporter = nodemailer.createTransport({
    service: 'gmail',
    auth: {
      user: 'summariesio@gmail.com',
      pass: gmail
    }
  })

  const mailOptions = {
    list: {
      unsubscribe: {
        /* url:  add url for users to come and unsubscribe
         might be a link to remove themselves from the firestore database
      */
        comment: 'Unsubscribe from this mailing list'
      }
    },
github jruizgit / rules / test / approve.js View on Github external
var mailer = require('nodemailer');
var stat = require('node-static');
var d = require('../lib/durable');

var transport = mailer.createTransport('SMTP',{
    service: 'Gmail',
    auth: {
        user: 'durablejs@gmail.com',
        pass: 'durablepass'
    }
});

d.run({
    approve1: {
        r1: {
            when: { $gt: { amount: 1000 } },
            run: function(s) { console.log('denied'); }
        },
        r2: {
            when: { $lte: { amount: 1000 } },
            run: function(s) { console.log('approved'); }
github kaloraat / nodeapi / helpers / index.js View on Github external
exports.sendEmail = emailData => {
  const transporter = nodeMailer.createTransport({
    host: "smtp.gmail.com",
    port: 587,
    secure: false,
    requireTLS: true,
    auth: {
      user: "masterjupiter2015@gmail.com",
      pass: "kshzlmomlthllktq"
    }
  });
  return transporter
    .sendMail(emailData)
    .then(info => console.log(`Message sent: ${info.response}`))
    .catch(err => console.log(`Problem sending email: ${err}`));
};
github RSchneyer / scoutingfrc / functions / index.js View on Github external
const admin = require('firebase-admin');
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');

admin.initializeApp(functions.config().firebase);

var db = admin.firestore();
var FieldValue = require('firebase-admin').firestore.FieldValue;

const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
	service: 'gmail',
	auth: {
		user: gmailEmail,
		pass: gmailPassword
	}
});
const APP_NAME = 'ScoutingFRC';

exports.userCreate = functions.auth.user().onCreate(event => {
	const user = event.data;
	const displayName = user.displayName;
	const uid = user.uid;
	const email = user.email;
	console.log('new user Created:'+ displayName+' UID: '+uid);

	var ref = db.collection('users').doc(uid);
github CreaturePhil / Showdown-Boilerplate / crashlogger.js View on Github external
}
	}

	console.error(`\nCRASH: ${stack}\n`);
	let out = require('fs').createWriteStream(logPath, {'flags': 'a'});
	out.on("open", fd => {
		out.write(`\n${stack}\n`);
		out.end();
	}).on("error", err => {
		console.error(`\nSUBCRASH: ${err.stack}\n`);
	});

	if (Config.crashguardemail && ((datenow - lastCrashLog) > CRASH_EMAIL_THROTTLE)) {
		lastCrashLog = datenow;
		try {
			if (!transport) transport = require('nodemailer').createTransport(Config.crashguardemail.options);
		} catch (e) {
			console.error(`Could not start nodemailer - try \`npm install\` if you want to use it`);
		}
		if (transport) {
			transport.sendMail({
				from: Config.crashguardemail.from,
				to: Config.crashguardemail.to,
				subject: Config.crashguardemail.subject,
				text: `${description} crashed ${exports.hadException ? "again " : ""}with this stack trace:\n${stack}`,
			}, err => {
				if (err) console.error(`Error sending email: ${err}`);
			});
		}
	}

	exports.hadException = true;
github apla / dataflo.ws / task / mail.js View on Github external
if (transport === "test") {
		return nodemailer.createTransport ({
			name: 'testsend',
			version: '1',
			send: function(data, callback) {
				callback();
			}
		});
	}

	if (transport.plugin) {
		var transPlugin = require (transport.plugin);
		return nodemailer.createTransport (transPlugin (transport.config));
	}

	return nodemailer.createTransport (transport);
}
github pablomarle / networkmaps / lib / sendmail.js View on Github external
function initialize(config) {
    queue_dir = config.queue;
    sent_dir = config.sent;
    from = config.from;

    transport = nodemailer.createTransport({
        host: config.server,
        port: config.port,
        secure: config.is_secured,
        tls: {rejectUnauthorized: config.verify_ssl_cert},
        auth: {
            user: config.user,
            pass: config.password
        }
    });
}