GithubHelp home page GithubHelp logo

emailer-api-node-js's Introduction

Node js Email API

Development setup

  • Install node js on machine
  • Checkout the repository
  • Rename 'config/default.example.json' to 'config/default.json'
  • Update SMTP details in 'default.json'
  • Open command line tool in directory where index.js
  • Execute command npm install
  • Execute command node index.js
  • You can replace this file with your app name e.g 'emailApp.js'

Server setup

  • Install node js on server, for more information Click Here
  • Install pm2 globally on server npm install pm2 -g, for more inforamtion Click Here
  • Rename 'config/default.example.json' to 'config/default.json'
  • Update SMTP details in 'default.json'
  • Execute command npm install
  • Start node server pm2 start <YourStartUpFileName>.js

Request body

Get Auth Token

Route
http://{domain}:{port}/admin/getKey
POST Request
Body:-

{
    "clientId" : "clientId",
    "expiryinDays": 50
}

Header:-

{
    "secretkey": "<Token generated by generate key above API>"
}

Send Email

Route
http://{domain}:{port}/email/send
POST Request
Header:-

{
    "secretkey": "<Admin key which is mentioned in defualt.json>"
}

Body:-

{
    "fromName": "My Name",
    "fromEmail": "[email protected]",
    "toEmails": "[email protected], [email protected]",
    "cCEmails": "[email protected], [email protected]",
    "bccEmails": "[email protected], [email protected]",
    "replyToEmails": "[email protected], [email protected]",
    "subject": "Subject",
    "htmlBody": "<b>Welcome</b>",
    "textBody": "welcome Test"
}

Note:- fromName, fromEmail, toEmails, cCEmails, bccEmails, replyToEmails are optional fields if you not sent through request body, API will take it from client configuration file

emailer-api-node-js's People

Watchers

Rohit Jadhav avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.