Coder Social home page Coder Social logo

email-api's Introduction

Email Dispatcher API (ノ◕ヮ◕)ノ*・゚✧ ✉️

Small server to send an emails 📭

API Usage

Send an email

POST https://{domain.com}/send

{
  "from": "",
  "to": "",
  "cc": "",
  "subject": "",
  "text": "",
  "html": "",
}

It returns a status code 200 if the domain origin is whitelisted, or the the access key is provided in the Authorization header, otherwise it returns 401.

API Setup

Node is required and SMTP credentials

  1. Create an .env file with the following configuration.
# SERVER
DOMAIN="{domain.com}"
PORT=3000
# SECURITY WHITELIST (OPTIONAL): multiple domains are accepted if it is seperated with a coma, such as `domain1.org,domain2.org`
WHITELIST="domain.org"
# SECURITY ACCESS KEY (OPTIONAL)
AUTHORIZATION_KEY=""
# SMTP CONFIG
SMTP_HOST=""
SMTP_PORT=""
SMTP_FROM=""
SMTP_PASS=""
  1. Install NPM packages
npm install
  1. To start the server
# With NPM Command Line:
npm run start
# With Docker Compose:
docker-compose up
  1. Now you can request the following URLs:
  • GET https://{domain.com}/: it returns a status code 200 if the domain origin is whitelisted, or the the access key is provided in the Authorization header, otherwise it returns 401.
  • GET https://{domain.com}/readme: it returns the readme as HTML page. This page is public and not protected.
  • POST https://{domain.com}/send: it send an email, if the domain origin is whitelisted, or the the access key is provided in the Authorization header, otherwise it returns 401.

email-api's People

Contributors

steevepay avatar

Stargazers

Mohamed Safouan Besrour avatar Stanislav Kukucka avatar

Watchers

 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.