Skip to content

ab007shetty/nodejs-contact-form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeJS Contact Form

Contact form build with Bootstrap and Nodemailer.

Installation

  1. Clone the Repo.
$ cd nodejs-contact-form

$ npm install && npm start
  1. Open in browser
http://localhost:3000

Gmail SMTP Setup

  1. Setup app password for gmail
  2. Open app.js and change
const smtpTrans = nodemailer.createTransport({
    host: 'smtp.gmail.com',
    port: 465,
    secure: true,
    auth: {
    user: "username@gmail.com", 	// Change it to yours email address
    pass: "password", 				// App Password, (16 character Key)
    }
  })

Configuration

Open app.js

const mailOpts = {
    from: '"Contact Form" <username@gmail.com>', //Sender mail
    to: "username@gmail.com",					// Receiver mail
	subject: `${req.body.name}`,
    html: output
  }