Contact form build with Bootstrap and Nodemailer.
- Clone the Repo.
$ cd nodejs-contact-form
$ npm install && npm start
- Open in browser
http://localhost:3000
- Setup app password for gmail
- 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)
}
})
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
}