{"id":13565482,"url":"https://github.com/ReachFive/fake-smtp-server","last_synced_at":"2025-04-03T22:31:34.518Z","repository":{"id":25423485,"uuid":"103964041","full_name":"ReachFive/fake-smtp-server","owner":"ReachFive","description":"Fake SMTP Server for email testing","archived":false,"fork":false,"pushed_at":"2024-03-21T15:24:54.000Z","size":2248,"stargazers_count":191,"open_issues_count":53,"forks_count":78,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-14T07:51:37.927Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/fake-smtp-server","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReachFive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-18T16:29:10.000Z","updated_at":"2024-06-05T09:05:50.358Z","dependencies_parsed_at":"2024-01-14T03:51:51.063Z","dependency_job_id":"d572adf9-51ee-4fb2-a6cb-e6e52420c7fb","html_url":"https://github.com/ReachFive/fake-smtp-server","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReachFive%2Ffake-smtp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReachFive%2Ffake-smtp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReachFive%2Ffake-smtp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReachFive%2Ffake-smtp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReachFive","download_url":"https://codeload.github.com/ReachFive/fake-smtp-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247090252,"owners_count":20881940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:48.043Z","updated_at":"2025-04-03T22:31:33.602Z","avatar_url":"https://github.com/ReachFive.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\n# Fake SMTP Server\n\nFake SMTP Server is an email testing tool for QA \u0026 development teams. \nIt allows manual testing in a web interface, and automated testing via an API.\n\n## Docker image\n[reachfive/fake-smtp-server](https://hub.docker.com/r/reachfive/fake-smtp-server)\n\n## API\n\n#### Listing all received emails\n\nReceived mails are listed on `http://localhost:1080/api/emails`, and looks like this:\n\n```json\n[\n  {\n    \"attachments\": [],\n    \"text\": \"Hi Bob!\",\n    \"textAsHtml\": \"\u003cp\u003eHi Bob!\u003c/p\u003e\",\n    \"subject\": \"Hi\",\n    \"date\": \"2017-09-18T16:12:16.000Z\",\n    \"to\": {\n      \"value\": [\n        {\n          \"address\": \"bob@example.com\",\n          \"name\": \"Bob\"\n        }\n      ],\n      \"html\": \"\u003cspan class=\\\"mp_address_group\\\"\u003e\u003cspan class=\\\"mp_address_name\\\"\u003eBob\u003c/span\u003e \u0026lt;\u003ca href=\\\"mailto:bob@example.com\\\" class=\\\"mp_address_email\\\"\u003ebob@example.com\u003c/a\u003e\u0026gt;\u003c/span\u003e\",\n      \"text\": \"Bob \u003cbob@example.com\u003e\"\n    },\n    \"from\": {\n      \"value\": [\n        {\n          \"address\": \"joe@example.com\",\n          \"name\": \"Joe\"\n        }\n      ],\n      \"html\": \"\u003cspan class=\\\"mp_address_group\\\"\u003e\u003cspan class=\\\"mp_address_name\\\"\u003eJoe\u003c/span\u003e \u0026lt;\u003ca href=\\\"mailto:joe@example.com\\\" class=\\\"mp_address_email\\\"\u003ejoe@example.com\u003c/a\u003e\u0026gt;\u003c/span\u003e\",\n      \"text\": \"Joe \u003cjoe@example.com\u003e\"\n    },\n    \"messageId\": \"\u003c1433879119.43.1505751136615@[10.143.108.87]\u003e\",\n    \"html\": false\n  }\n]\n```\n\nYou can filter emails with the following parameters:\n\n * `from`: filter sender\n * `to`: filter recipient\n * `since`: filter email date\n * `until`: filter email date\n \nExample:\n\n```\n    GET http://localhost:1080/api/emails?from=joe@example.com\u0026to=bob@example.com\u0026since=2017-09-18T12:00:00Z\u0026until=2017-09-19T00:00:00Z\n```\n\n##### Viewing headers in responses\n\nBy default, fake-smtp-server will not capture custom headers in emails. To enable headers, start the server with the `--headers` flag. If enabled, headers will be serialized as an object type. \n\nFor reference for what headers look like, consult [Nodemailer's documentation](https://nodemailer.com/extras/mailparser/#headers-map), but keep in mind that the HTTP endpoint returns plain JSON objects rather than `Map`s.\n\n#### Removing all received email\n\nTo remove all emails without restarting the server:\n```\n    DELETE http://localhost:1080/api/emails\n``` \n\n\n## Web interface\n\nGo to `http://localhost:1080`\n\n## Install\n\n```bash\n  npm install -g fake-smtp-server\n```\n\n## Usage\n\n```\nUsage:\n  fake-smtp-server [OPTIONS] [ARGS]\n\nOptions:\n  -s, --smtp-port [NUMBER] SMTP port to listen on (Default is 1025)\n      --smtp-ip [IP]       IP Address to bind SMTP service to (Default is 0.0.0.0)\n  -h, --http-port [NUMBER] HTTP port to listen on (Default is 1080)\n      --http-ip [IP]       IP Address to bind HTTP service to (Default is 0.0.0.0)\n  -w, --whitelist STRING   Only accept e-mails from these adresses. Accepts\n                           multiple e-mails comma-separated\n  -m, --max [NUMBER]       Max number of e-mails to keep (Default is 100)\n  -a, --auth STRING        Enable Authentication\n      --headers            Enable headers in responses\n  -k, --no-color           Omit color from output\n      --debug              Show debug information\n```\n\n## Configure fake-smtp-server to run as a service at startup\n\nThese instructions below were tested on **Ubuntu 18.04 LTS** but they should work out of the box (or close to it) on any distribution using ***systemd*** and ***rsyslog***.\n\n### Systemd service\n\n#### Create the `fakesmtp.service` service unit\n* `sudo vim /etc/systemd/system/fakesmtp.service` with the following content\n```shell\n[Unit]\nDescription=Fake SMTP service\nAfter=network.target\nStartLimitIntervalSec=0\nStandardOutput=syslog\nStandardError=syslog\nSyslogIdentifier=fake-smtp-server\n\n[Service]\nType=simple\nRestart=always\nRestartSec=1\nExecStart=/usr/local/bin/fake-smtp-server  # You can add extra options and arguments here\n\n[Install]\nWantedBy=multi-user.target\n```\n\n#### Make the new service launch on startup\n* `sudo systemctl enable fakesmtp.service`\n\n#### Start/Stop/Restart the service\n* `sudo systemctl start fakesmtp.service`\n* `sudo systemctl stop fakesmtp.service`\n* `sudo systemctl restart fakesmtp.service`\n\n### Logging using rsyslog\n\nThe output is recorded by default to `/var/log/syslog` but you can create a separate log file for your service (in this example, logs will be saved to `/var/log/fakesmtp.log`).\n\n#### Create a new **rsyslog** config file\n* `sudo vim /etc/rsyslog.d/fakesmtp.conf` with the following content:\n```shell\nif $programname == 'fake-smtp-server' then /var/log/fakesmtp.log\n\u0026 stop\n```\n\n#### Restart **rsyslog** and then restart your shiny new fakesmtp service\n* `systemctl restart rsyslog.service`\n* `systemctl restart fakesmtp.service`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FReachFive%2Ffake-smtp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FReachFive%2Ffake-smtp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FReachFive%2Ffake-smtp-server/lists"}