Backend template for sending emails
How to install
npm i backend-contact-form
Dependencies
- nodemailer
- express
- body-parser
- dotenv
Setup
Create a .env file and paste this
EMAIL = "your-gmail"PASS = "your-email-password or app-specific-password"
This will get imported, don't share or upload your .env file.
Gmail has some built-in security, and if you use multi-factor authentication, you're required to create an app specific password. This is done on your google profile.
How to use
var mail = ; ;
Starting server
node yourscriptname
The port is set to 8080, you can change the 'PORT' variable if you wish, the rest of the code will follow along.
Go to localhost:8080 (if you didn't change the 'PORT' variable), and your form will show.
Submit, and the module will parse the data and send the email to your gmail account!