#smtp #smtp-server #webassembly


The library used in mailtutan project to implement an SMTP server for test and development environments

4 releases (2 breaking)

0.3.0 Jun 18, 2023
0.2.0 Jun 6, 2023
0.1.1 Jun 4, 2023
0.1.0 Jun 3, 2023

#380 in Email

Download history 11/week @ 2023-11-06 7/week @ 2023-11-13 18/week @ 2023-11-20 18/week @ 2023-11-27 2/week @ 2023-12-04 9/week @ 2023-12-11 6/week @ 2023-12-18 12/week @ 2023-12-25 7/week @ 2024-01-01 16/week @ 2024-01-08 4/week @ 2024-01-15 5/week @ 2024-01-22 13/week @ 2024-01-29 39/week @ 2024-02-05 65/week @ 2024-02-12 129/week @ 2024-02-19

246 downloads per month
Used in mailtutan

MIT license

1.5K SLoC

JavaScript 806 SLoC // 0.0% comments Rust 709 SLoC


This is a repository for Mailtutan, a SMTP server built in Rust. The server allows you to simulate an SMTP (Simple Mail Transfer Protocol) server for testing and development purposes without actually sending emails to real addresses.



  • Simulates an SMTP server locally for testing and development.
  • Logs all incoming emails, including the headers and body.
  • Provides a web interface and REST API to view the list of emails.
  • Basic HTTP Authentication on web interface and REST API ( rfc7617 )
  • Supports multiple client connections simultaneously.
  • Supports encryption on transit (TLS) on SMTP
  • Supports real-time updates using WebSockets for the web interface.
  • Lightweight and efficient implementation in Rust. The docker image on docker hub is < 2MB.
  • Multiple storage options: Memory ( default ), Maildir ( in file )
  • Supports SMTP Auth ( Plain )


Compile from source

git clone git@github.com:mailtutan/mailtutan.git
cd mailtutan
make all # app will be available at ./target/release/mailtutan


cargo install mailtutan


yay -S mailtutan-bin


docker run -p 1080:1080 -p 1025:1025 -d mailtutan/mailtutan:latest

Download binary executables

Check out the latest release


By default, Mailtutan listens on port 1025 for SMTP and logs incoming emails to memory. The web interface is available on port 1080. However, you can customize the server configuration by supported parameters and environment variables.

$ mailtutan -h
An SMTP server for test and development environments.

Usage: mailtutan [OPTIONS]

      --ip <IP>
          IPv4 address [env: MAILTUTAN_IPADDR=] [default:]
      --http-port <HTTP_PORT>
          HTTP Port number [env: MAILTUTAN_HTTP_PORT=] [default: 1080]
      --smtp-port <SMTP_PORT>
          SMTP Port number [env: MAILTUTAN_SMTP_PORT=] [default: 1025]
      --smtp-cert-path <SMTP_CERT_PATH>
          SMTP Cert Path [env: MAILTUTAN_SMTP_CERT_PATH=]
      --smtp-key-path <SMTP_KEY_PATH>
          SMTP Key Path [env: MAILTUTAN_SMTP_KEY_PATH=]
      --smtp-auth-username <SMTP_AUTH_USERNAME>
          SMTP Auth Username [env: MAILTUTAN_AUTH_USERNAME=]
      --smtp-auth-password <SMTP_AUTH_PASSWORD>
          SMTP Auth Password [env: MAILTUTAN_AUTH_PASSWORD=]
          HTTP Auth [env: MAILTUTAN_HTTP_AUTH=]
      --http-username <HTTP_USERNAME>
          HTTP Username [env: MAILTUTAN_HTTP_USERNAME=] [default: admin]
      --http-password <HTTP_PASSWORD>
          HTTP Password [env: MAILTUTAN_HTTP_PASSWORD=] [default: admin]
      --messages-limit <MESSAGES_LIMIT>
          Messages Limit [env: MAILTUTAN_MESSAGES_LIMIT=] [default: 1000]
      --storage <STORAGE>
          Storage [env: MAILTUTAN_STORAGE=] [default: memory] [possible values: memory, maildir]
      --maildir-path <MAILDIR_PATH>
          Storage [env: MAILTUTAN_MAILDIR_PATH=] [default: maildir]
  -h, --help
          Print help
  -V, --version
          Print version


To send emails to Mailtutan, configure your email client or application to use the server's IP address or hostname and the configured port number. Any emails sent to this server will be captured and logged.

You can access the web interface to view the list of logged emails by navigating to http://localhost:1080 in your web browser. Additionally, a REST API is available at http://localhost:1080/api/ to programmatically access the email data.


HTTP method endpoint description
GET /api/messages get list of messages
GET /api/messages/:id/json get message's details
GET /api/messages/:id/source get message's source
GET /api/messages/:id/plain get message's plain text
GET /api/messages/:id/html get message's HTML
GET /api/messages/:id/parts/:cid get message's attachment
DELETE /api/messages/:id delete a message
DELETE /api/messages delete all messages
GET /api/version get application version
GET /api/ws subscribe to web socket to get updates


Contributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository. Make sure to follow the existing coding style and guidelines.


This project is licensed under the MIT License. Feel free to use, modify, and distribute it as per the terms of the license.


  • This project was inspired by the need for a lightweight fake SMTP server for testing and development purposes.
  • Thanks to the Rust programming language community for providing excellent tools and libraries for building efficient and reliable software.


~239K SLoC