Skip to content

epaminond/meteor-nodemailer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meteor-nodemailer

Meteor wrapper for Nodemailer.

Install

meteor add epaminond:nodemailer

TL;DR Usage Example

This is a complete example to send an e-mail with plaintext and HTML body

// create reusable transporter object using SMTP transport
var transporter = Nodemailer.createTransport({
  service: 'Gmail',
  auth: {
    user: '[email protected]',
    pass: 'userpass'
  }
});

// NB! No need to recreate the transporter object. You can use
// the same transporter object for all e-mails

// setup e-mail data with unicode symbols
var mailOptions = {
  from: 'Fred Foo ✔ <[email protected]>', // sender address
  to: '[email protected], [email protected]', // list of receivers
  subject: 'Hello ✔', // Subject line
  text: 'Hello world ✔', // plaintext body
  html: '<b>Hello world ✔</b>' // html body
};

// send mail with defined transport object
var info = transporter.sendMail(mailOptions);
console.log('Message sent: ' + info.response);

transport.close();

Note that Nodemailer#sendMail and Nodemailer#close functions are wrapped with Meteor.wrapAsync so that you can use them synchronously.

For more details you can check Nodemailer documentation.

About

Meteor wrapper for Nodemailer

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%