This project is design to simplify the process of sending emails, by providing a template which is easy to setup and connet with your email.
- Fork the repo.
- Install required modules/dependencies.
- Modify index.js file to connect to your email.
- Deploy on your favourite platform(Heroku/GCP/Aws...).
- Git
- Node.js and NPM
- Heroku Account
- Heroku CLI
- Your favourite editor
// Run following commands in terminal/cmd to check if we are ready to go
git --version
node -v
npm -v
heroku -v
-
- Get this project on your local machine.
- Open terminal/cmd.
- Navigate to that folder using cmd/terminal.
-
- Execute command >>>
npm init 👇🏼
- Enter the necessary details and finish setup.
- Execute command >>>
-
npm install nodemailer --save
npm install cors --save
npm install express --save
npm install morgan --save
-
- Enter email in index.js line 11.
- Enter app password of your above account in line 12 index.js.
- Navigate to {project_path}/package.json and add
"start": "node index"
inside"scripts"
key.
Enter npm start
in terminal/cmd, this should start the server at http://localhost:3000
if nothing goes wrong. Now copy this url and open in your favourite browser, you will see a page like👇 .
Follow below steps to deploy this server from localhost to heroku, after which you will be able to execute use your heroku-url for sending emails.
-
- Create a simple app on http://heroku.com/ .
- By clicking new >> create new app.
- Enter app name (whatever you want) and create app.
-
- Execute below commands in terminal, make sure that you are into your project directory.
- Login to Heroku CLI:
heroku login
- Create new empty repo:
git init
- Add all changes to repo:
git add .
- Commit changes:
git commit -m "init"
- Add remote repo:
heroku git:remote -a <your app name>
- Push changes:
git push heroku master