Installation
To install Nodemailer in your Node.js project, follow these steps:
Step 1: Initialize Your Projectβ
First, make sure you have Node.js and npm installed. If not, you can download and install them from the official Node.js website.
-
Create a new directory for your project (if you don't already have one):
mkdir my-project
cd my-project -
Initialize a new Node.js project:
npm init -y
Step 2: Install Nodemailerβ
You can install Nodemailer using npm. Run the following command in your project directory:
npm install nodemailer
This command will install Nodemailer and add it to your package.json
file as a dependency.
Setp 3: How Importβ
Two methods to import the package
- In node & Express Js
const nodemailer=require('nodemailer')
- In another ES6 method
import nodemailer from 'nodemailer'