How to use the nodemailer.sendMail 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 prey / prey-node-client / lib / agent / transports / smtp / index.js View on Github external
this.send_email = function(host, email_data, callback){

		this.log('Trying to send to ' + email_data.to + ' at ' + host);

		var transport_opts = {host: host, secureConnection: false}; // SSL bug?
		var transport = mailer.createTransport("SMTP", transport_opts);
		email_data.transport = transport;

		mailer.sendMail(email_data, function(err){
			transport.close();
			callback(err);
		});

	};
github senchalabs / jsduck / opt / comments-server-side / util.js View on Github external
var sendSubscriptionEmail = function(emails) {
        var email = emails.shift();

        if (email) {
            nodemailer.sendMail(email, function(err){
                if (err){
                    console.log(err);
                } else{
                    console.log("Sent email to " + email.to);
                    sendSubscriptionEmail(emails);
                }
            });
        } else {
             console.log("Finished sending emails");
             mailTransport.close();
        }
    };
github ollieparsley / node-site-monitor / lib / communication / base.js View on Github external
auth: {
			user: this.baseConfig.email.username,
			pass: this.baseConfig.email.password
		}
	});
	
	var mailOptions = {
		transport: transport,
		from: "Site Alert <" + this.baseConfig.email.sender + ">",
		to: this.config.address,
		subject: up_down == 'down' ? site.name + ' is down!' : site.name + ' is up!',
		text: body,
		html: htmlBody
	}

	nodemailer.sendMail(mailOptions, function(error){
		if(error){
			callback(false, error);
		}else{
			callback(true);
		}
	});		
		
}