How to send email without using any server side language with the help of node.js?
What is node.js ?
Node.js is a server-side platform built-in JavaScript framework
The steps to be followed :
Step 1: Install node.js
Step 2: Install npm (node package manager)
Step 3: Install node mailer by running : “ npm install nodemailer “
Step 4: Create a file called “package.json” in your project folder and write the following code :
Step 5: Run “ npm install “
Step 6: Create a “Server.js”
Step 7: Create a form on index.html page
Step 8: Write js code form Submit button, this code will check the validation before sending mail.
Include this file on index.html by using :
“ http://js/node-mailer-contact.js “
index.html form (view) :
Step 9: Create a method for SMTP ( Simple Mail Transfer Protocol ) in “Service.js” file through which email will be send:
Step 10: Create a method for sending email in “Server.js” file:
Step 11: Start the node js server on the terminal by running :
“ node Server.js “
It will look like :
After filling the form and clicking on “Submit” the email will get send to the respective email id and on terminal it will look like :
Source: Send Mail Using Node.js