6

Integrate Nodemailer with EJS for Email Template

 1 year ago
source link: https://blog.bitsrc.io/integrate-nodemailer-with-ejs-for-email-template-ea2f77aaee2a
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Integrate Nodemailer with EJS for Email Template

How to send mail using Nodemailer with EJS for email template

1*f68qQoR9y6oC4mmOZqUmaQ.png

Nodemailer Logo

Nodemailer is a module for Node.js applications to allow easy as cake email sending. The project got started back in 2010 when there was no sane option to send email messages, today it is the solution most Node.js users turn to by default. (source: nodemailer official website)

EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No religiousness about how to organize things. No reinvention of iteration and control-flow. It’s just plain JavaScript. (source: ejs official website)

Note: Make sure Node.js is already installed at your computer. If not, please download and install from this site.

1. Setup Project

Just type and run in your terminal / command line.

$ mkdir nodemailer_ejs
$ cd nodemailer_ejs

nodemailer_ejs folder has been created. Next step is to initialize a node module for your folder.

$ npm init --y

Next, we need to install some packages for this project.

  • express : a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
  • nodemailer : send emails from Node.js — easy as cake!
  • ejs : EJS is a simple templating language that lets you generate HTML markup with plain JavaScript.
$ npm i express nodemailer ejs

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK