Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jirengu/easymailer

a simple smtp mailer
https://github.com/jirengu/easymailer

Last synced: 4 days ago
JSON representation

a simple smtp mailer

Awesome Lists containing this project

README

        

# easymailer

a simple smtp mailer base on node mailer

## useage

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

```javascript
var nodemailer = require("nodemailer");

// create reusable transport method (opens pool of SMTP connections)
var smtpTransport = nodemailer.createTransport("SMTP",{
service: "Gmail",
auth: {
user: "[email protected]",
pass: "userpass"
}
});

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

// send mail with defined transport object
smtpTransport.sendMail(mailOptions, function(error, response){
if(error){
console.log(error);
}else{
console.log("Message sent: " + response.message);
}

// if you don't want to use this transport object anymore, uncomment following line
//smtpTransport.close(); // shut down the connection pool, no more messages
});
```