a REST only mail server for ephemeral email addresses
Перейти к файлу
Rachael 669b472224
Merge pull request #167 from mozilla/dockerfile
Adding netcat to dockerfile
2024-10-03 12:28:40 -05:00
.circleci add circleci config 2022-10-19 14:44:10 -07:00
.github updating github action 2024-09-04 13:23:39 -05:00
ansible use node-convict for configuration; reorg directory structure to bin/,lib/; use const/let as appropriate (#35) 2018-08-07 10:41:02 -04:00
bin add lbheartbeat endpoint 2024-09-18 10:45:16 -07:00
docker Adding netcat to dockerfile 2024-10-03 12:28:33 -05:00
lib send a strict-transport-security header 2019-02-12 14:20:20 -08:00
tests add lbheartbeat endpoint 2024-09-18 10:45:16 -07:00
website Point "fork me on github" to the new repository location 2013-08-02 12:54:03 +10:00
.eslintrc use node-convict for configuration; reorg directory structure to bin/,lib/; use const/let as appropriate (#35) 2018-08-07 10:41:02 -04:00
.gitignore add a quick loadtest 2017-05-15 21:13:42 -07:00
CODE_OF_CONDUCT.md Add Mozilla Code of Conduct file 2019-03-28 08:13:43 -07:00
LICENSE Create LICENSE 2023-02-21 15:28:50 -08:00
README.md add lbheartbeat endpoint 2024-09-18 10:45:16 -07:00
package-lock.json Bump eslint from 9.10.0 to 9.11.1 2024-09-24 12:04:22 +00:00
package.json Bump eslint from 9.10.0 to 9.11.1 2024-09-24 12:04:22 +00:00

README.md

Email addresses for testing

Build Status

Have you ever wanted to write an automated test of a service that sends email? If you have, you might have wanted an email address that you can check using a simple REST service that returns JSON...

..that's what restmail.net is.

overview

restmail.net is an email server with a REST API. Any time an email is sent to a @restmail.net address, the email address springs into existence and the message is stored (with a max of 10 emails per "user"). You can query the restmail API to check the email of any user, and you can also delete outstanding messages via the API.

This lets you test services that deliver email.

By default, emails are deleted after one day. You can change this by modifying the expireAfter parameter in config.js. Set it to 0 for no auto-deletion, in which case you will want to keep an eye on your redis database size.

security?

All mail sent to restmail email addresses is completely public. anyone may delete the messages associated with any user. This service is wide open. If that won't do, you should fork and deploy your own instance of restmail, and add sekrets and stuff.

the API

DELETE /mail/<user>

Delete all of the mail for the named user (where user is the user portion of the email address, not including @restmail.net).

Returns 200 on success.

GET /mail/<user>

Returns all mail for the specified user, as an array of JSON blobs, with the newest messages first. Here's example output (with lots of fields stripped out):

[
  {
    "headers": {
      "date": "Fri, 11 May 2012 14:44:37 -0600",
      "mime-version": "1.0 (Apple Message framework v1257)"
    },
    "from": [
      {
        "address": "lloyd@example.com",
        "name": "Lloyd Hilaiel"
      }
    ],
    "to": [
      {
        "address": "test@restmail.net",
        "name": ""
      }
    ],
    "subject": "this is my first message",
    "text": "it is very pretty.\n"
  },
  {
    "headers": {
      "date": "Fri, 11 May 2012 14:44:52 -0600",
      "mime-version": "1.0 (Apple Message framework v1257)"
    },
    "from": [
      {
        "address": "lloyd@example.com",
        "name": "Lloyd Hilaiel"
      }
    ],
    "to": [
      {
        "address": "test@restmail.net",
        "name": ""
      }
    ],
    "subject": "this is my second message",
    "text": "it's pretty awesome too.\n"
  }
]

Development

Prerequisites

You have redis running on port 6379. There are configuration variables you can adjust in lib/config.js.

  1. npm install
  2. npm run tests
  3. npm start