Sending e-mails is a very common requirement for our applications. Use cases may include system administration alerts, monthly reports for application stakeholders, or even performing bulk mail operations.
In this recipe, we will send e-mails using a popular Node package called nodemailer. This will allow us to send text and HTML-based e-mails easily through our applications.
To begin, we must install the nodemailer npm
package:
npm install [email protected] --save
Tip
Note that as of this writing, the current version of the nodemailer package has some compatibility issues with using Gmail's SMTP server. For this reason, we install version 0.7.1, a version known to work.
You can view the project documentation for nodemailer on its GitHub home page at http://www.github.com/andris9/Nodemailer.
We will also create a configuration file that our examples can use. Create a file named mailer-config.coffee
with the following content:
module.exports = service: 'Gmail' auth...