Skip to content

lalapolalaanewb/sendMail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Send Mail

Implementation of sending notification email with Nodemailer.

Tutorial

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Software you need to install:-

// Visual Studio Code Installation
Go to Visual Studio Code link above and choose download according to your machine type (choose the **stable** version):-
- Window, go for Windows Installer
- MacOS, go for MacOS Installer
- Linux, go for Linux Installer

// Node.js Installation
Go to Node.org link above and choose your machine type (Please choose the **LTS download version** instead of the Current version):-
- Window, go for Windows Installer
- MacOS, go for MacOS Installer

Installing

Please follow the step below to get the system running

  1. After download or git repo the Project file. Place your Project folder anywhere in your system (doesn't matter where actually)
  2. Open your Code Editor (Visual Studio Code or any other code editor)
  3. Go to your Terminal in Visual Studio Code or open CMD - Command Prompt, manuver to where your Project folder located and do the following installation:- (make sure you already inside your Project folder. Eg: C:\parentFolder\ProjectFolder) in order to get the final version running properly
  • Install all dependencies required (as stated in package.json)
in your Terminal or CMD, it's gonna look like this:-
C:\sendMail\final\>npm install
  • Once installation finishes with no errors. Then start the project:-
C:\sendMail\final\>npm start

Important Notes

  1. This project contain 2 main folders:-
  • starter (contain starter codes and files needed)
  • final (contain a complete working web app - finished code)
  1. This project aims to teach you how to implement a sending of email notification with Nodemailer.
  2. This project will not cover the part of designing and implementing or coding of the UI.

Step By Step Guides

  • create a starter folder
  • npm init
  • install dependencies
    • nodemon
    • express
    • dotenv
    • nodemailer
  • create & setup index.js
  • create & setup home routes
    • create & setup GET home route
      • create a function to handle render of HOME page
      • render HOME page
    • create & setup POST home route
      • setup errorMessage handler
      • create & setup send notification email
        • setup Gmail API at Google Console API
          • get client id
          • get client secret
        • setup callback connection at OAuth 2.0 Playground
          • in Step 1: Select & suthorize APIs, input scope to https://mail.google.com/ and click button Authorize APIs
          • in *Step 2: Exchange authorization code for tokens *, set or check auto-refresh token to true
        • OPTIONAL setup dedicated or other email extension other than gmail (Eg: .com/ .net/ .io/ etc)
      • re-render HOME page

Deployment

No additional support on how to deploy on live system for this project.

Built With

  • EJS (Front-end Framework)
  • Node JS (Back-end Framework)

Authors

Acknowledgments

These are some of the online sources which I learnt from. You may do so as well.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published