Is this really much easier than using https://www.npmjs.org/package/mailer? Also, unless nodemailer is written by the same developer as mailer, it appears they copied the tagline, "simple as cake".
email.send({
host : "smtp.gmail.com", // smtp server hostname
port : "465", // smtp server port
ssl: true,
domain : "localhost", // domain used by client to identify itself to server
to : "recipient@somewhere.com",
from : 'sender@somewhere.com',
subject : 'My Subject',
body: 'Blah\nBlah\nBlah.,
authentication : "login", // auth login is supported; anything else is no auth
username : '',
password : ''
},
function (err, result) {
});
"mailer" and its derivatives are deprecated in favor of "nodemailer". Besides, "mailer" uses "nodemailer" as its backend (it used to have its own SMTP client but it had a lot of shortcomings), so it doesn't really count. You could as well create your own wrapper areound "nodemailer" that would be even easier to use.
I started using this in all my node projects a couple years ago. It has been my favorite email library in any language I've used. I love the pre-configured services for gmail and sendgrid, etc. Surprised to see it posted - I figured everyone already was using it.
Nice module. Logo is pretty nifty too. The default "well known" server list is particularly useful.
If you happen to use this with AWS watch out though. It's hard coded to US east. If you're not in that region then you should configure the server manually to a local end point so that you don't have to pay for bandwidth. Would be a tad faster too.
This might be a minor comment, but I noticed you guys are using Node.js with Express.js to render nodemailer.com. You can (and maybe should) change the favicon from the default Express.js favicon.
You can do so by removing `app.use(express.favicon());` from the generated app.js file. At the very least, you could add your own favicon in your public/ folder to make the project page look (albeit in the most vain sense) more polished.
Regardless of which package you use for delivering email, I can't recommend enough to put the email delivery code into an async job queue that automatically retries.
Even with major providers there are enough occasional blips that you don't want to impact delivery of your email. Additionally, it would allow you to decouple sending (popping from the queue) if you ever needed to delay it momentarily.
Ideally yes, it's running on a different machine. But most certainly a different process.
For the queue, I've wrapped redis and rabbitmq clients with a simple retry logic that re-enqueues the job on failure to send. It's about choosing what's right for your use case.
This module is the main cog behind the email delivery service application in my organization, which I built over a year ago, and it has been supremely reliable while handling 40-50 million emails per month. Just my testimonial.
I'm the author of Nodemailer. I'm not a native english speaker and I "borrowed" the tagline from a Node.js module by Marak Squires and didn't realize that "easy as cake" is not a widely used expression but something he probably made up himself.