O'Reilly logo

Node Cookbook Second Edition by David Mark Clements

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending an e-mail

On many platforms, the ability to send e-mail is a standard core feature, but Nodes' minimal approach to core leaves the actual implementation of e-mail protocols up to third-party modules.

Thankfully, there are some excellent module creators in the Node community who have already created modules for sending an e-mail. In this recipe, we'll be using the well-featured third-party nodemailer module to send an imaginary newsletter to a list of recipients.

Getting ready

In order to send an e-mail, we'll need a functioning Simple Mail Transfer Protocol (SMTP) server that we can connect to. In a later recipe, we'll be creating our own SMTP server, but for now, we'll have to acquire some SMTP details to use our client with.

If we have an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required