Back to services

OpenTrashmail

Complete trashmail solution that exposes an SMTP server and has a web interface to manage received emails. Works with multiple and wildcard domains and is fully file based (no database needed). Includes RSS feeds and JSON API.

View alternatives to OpenTrashmail
Suggest edit
Open source
Self-hostable
Apache-2.0
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Overview

OpenTrashmail is an open-source, self-hosted disposable email program developed by HaschekSolutions and released under the Apache-2.0 license. It comes with its own Python-based SMTP server. Just point your domain's MX record at your server and open port 25, and any email address under that domain can receive mail right away, with no need to create accounts in advance. Incoming emails are stored as JSON files, and the whole system is entirely file-based and needs no database.

Key Features

  • Catch-all reception: Accepts all mail sent to the configured domains. Wildcard subdomains such as *.example.com are supported.
  • Multiple ways to read mail:
    • Web interface: switches automatically between dark and light mode, shows plain-text and HTML bodies, lets you download attachments and delete emails, generates random email addresses, and checks for new mail automatically.
    • A separate RSS feed for every email address.
    • JSON API: list emails, fetch full email content, fetch the raw email, download attachments, and delete emails or entire accounts.
    • Webhook: can be set globally or per mailbox, with customizable JSON content.
  • Attachment handling: Attachments can be stored and downloaded, and you can limit the maximum size of each attachment. HTML emails are sanitized to prevent malicious content from loading, and inline images are displayed directly via Content-ID.
  • Encrypted transport: Since v1.3.0, plain text, STARTTLS and TLS on Connect (usually on port 465) are supported, and Let's Encrypt certificates, including wildcard certificates, can be used.
  • Administration: You can enable an admin menu with its own password to view server logs and all accounts. If you set an ADMIN address, you can view the emails of all accounts, which works like a honeypot mode.
  • Access control: You can set an access password for the whole site and the API, or use ALLOWED_IPS to allow only specific IP ranges. Trusted reverse proxies can also be configured.
  • Automatic cleanup: Use DELETE_OLDER_THAN_DAYS to automatically delete emails older than a given number of days.
  • Avoiding disposable-email blocklists: The server greeting looks like that of an ordinary mail server and does not reveal the software name. With DISCARD_UNKNOWN enabled, mail addressed to other domains is rejected directly during the SMTP session, so the server isn't mistaken for an open relay. Temporary errors return 451 so the sender retries. Search engines are also blocked from indexing the web interface, API and RSS.

Target Users and Use Cases

  • Privacy-conscious individuals: set up disposable mailboxes on your own domain so you don't expose your real email address when signing up for websites.
  • Developers and testers: automatically read verification codes and two-factor authentication emails through the JSON API or webhooks for automated testing.
  • Security researchers: use it as an email honeypot to collect spam and phishing emails.
  • Teams or communities: offer an internally shared disposable email service, and use NOTICE to display an announcement at the top of the page, such as how long emails are kept.

Deployment

  1. Configure DNS: Add an MX record for your domain that points to the server running OpenTrashmail. For example:
mail.example.com.  IN  A   93.184.216.34
example.com. 14400 IN  MX  10 mail.example.com.
  1. Run with Docker (recommended):
docker run -d --restart=unless-stopped --name opentrashmail \
  -e "DOMAINS=mydomain.eu" -e "SMTP_HOSTNAME=mail.mydomain.eu" \
  -e "DISCARD_UNKNOWN=true" -e "DELETE_OLDER_THAN_DAYS=90" \
  -p 80:80 -p 25:25 \
  -v /path/to/data:/var/www/opentrashmail/data \
  hascheksolutions/opentrashmail:1
  1. Configuration: Without Docker, edit config.ini; with Docker, set environment variables. Common options include URL, DOMAINS, PASSWORD, ALLOWED_IPS, WEBHOOK_URL and TLS_CERTIFICATE. The web interface can be placed in a subdirectory and accessed through a reverse proxy (such as nginx).

Technical Requirements

  • Backend: PHP 8.1+ plus Python 3.11 (SMTP server), with htmx on the frontend.
  • Port 25 must be open to the public internet, and you need a domain whose MX record you can configure.
  • No database is needed. Data is stored as files, and mounting the data directory keeps it persistent.

Notable Points

  • No need to create mailboxes beforehand: any validly formatted address can receive mail.
  • Random addresses are generated by combining adjective and noun word lists, and you can mount your own word lists to replace them.
  • For public deployments, it is strongly recommended to enable DISCARD_UNKNOWN=true; otherwise the server may be treated as an open relay and get blocklisted.