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

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

		if(!this.em) this.em = new mailer.EmailMessage(email_data);
		else { // nasty fix to prevent nodemailer from duplicating from/to addresses
			this.em.fromAddress = [];
			this.em.toAddress = [];
		}

		this.em.SERVER = { host: host }
		this.em.send(function(error, success){

			if(error) self.log("!! " + error);
			if(success) self.log(' -- Message sent!');

			return callback(success);

		});

	};
github Marak / node_mailer / lib / node_mailer.js View on Github external
function dispatchMail(message, server, callback) {
      var _message = {
          to: message.to,
          sender: message.from,
          subject: message.subject,
          server: server,
          debug: message.debug
      };
      if(message.html)_message.html = message.html;
      pool.send(new EmailMessage(merge(message, _message)), callback);
  }