Book Image

CoffeeScript Application Development Cookbook

By : Mike Hatfield
Book Image

CoffeeScript Application Development Cookbook

By: Mike Hatfield

Overview of this book

Table of Contents (18 chapters)
CoffeeScript Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Sending e-mail


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.

Getting ready

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...