Git Product home page Git Product logo

pode-smtp-server's Introduction

SMTP Server

This is a simple SMTP server for testing/dev purposes - built using Pode in PowerShell.

It has two servers, one for receiving email (smtp-server.ps1) and another for a front-end/rest-api site (web-server.ps1).

Installing and Running

At the moment you just have to clone the repo, and it only supports Windows. Once cloned, you have two options to start running the servers:

  1. Manually run the scripts:

    • First, install Pode, Invoke-Build and Yarn
    • At the root of the repo, run: pode install then pode build
    • In two seperate PowerShell sessions run each of the smtp-server.ps1 and web-server.ps1 scripts to start the servers running
  2. Install the servers as Windows Services:

    • At the root of the repo, run the install.ps1 script
    • This will install/build the dependencies and then setup the servers as Windows Services called Pode SMTP Server and Pode SMTP Web Server

Each server can then be accessed on the following endpoints:

  • SMTP: Server - localhost, Port - 25
  • Web: http://localhost:8025

(These can be configured in the repo's pode.json file)

Purging Emails

By default, the server is configured to automatically purge emails older than 2hrs (this can be configured in the repo's pode.json file).

Web Site

The SMTP server's website can be accessed by default on http://localhost:8025, and allows you to see all emails being sent - including date/time, body, headers, recipients, etc.

REST API

The default endpoint for the REST API is on http://localhost:8025/api:

Endpoint Description QueryString
GET /api/email/:id Given an EmailId, will return details about the email none
DELETE /api/email/:id Given an EmailId, will delete the email none
GET /api/emails Returns an array of paged emails limit/page
GET /api/emails/sender Returns an array of emails for an email address whom sent the email email/limit
GET /api/emails/recipient Returns an array of emails for an email address that received an email email/limit

Examples

  • Get email with ID 4:

    Invoke-WebRequest 'http://localhost:8025/api/email/3' -Method Get
  • Delete an email with ID 4:

    Invoke-WebRequest 'http://localhost:8025/api/email/3' -Method Delete
  • Get the first page of 10 emails, then get the 3rd page of 10 emails (emails are ordered by most recently sent):

    Invoke-WebRequest 'http://localhost:8025/api/emails?limit=10&page=1' -Method Get
    Invoke-WebRequest 'http://localhost:8025/api/emails?limit=10&page=3' -Method Get
  • Get the last 7 emails sent by an email address:

    Invoke-WebRequest 'http://localhost:8025/api/emails/[email protected]&limit=7' -Method Get
  • Get the last 7 emails received by an email address:

    Invoke-WebRequest 'http://localhost:8025/api/emails/[email protected]&limit=7' -Method Get

pode-smtp-server's People

Contributors

badgerati 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.