Crates.io | mailtutan-lib |
lib.rs | mailtutan-lib |
version | 0.3.0 |
source | src |
created_at | 2023-06-03 18:28:53.216829 |
updated_at | 2023-06-18 02:10:58.701469 |
description | The library used in mailtutan project to implement an SMTP server for test and development environments. |
homepage | https://github.com/mailtutan/mailtutan |
repository | |
max_upload_size | |
id | 881788 |
size | 602,986 |
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.
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
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]
Options:
--ip <IP>
IPv4 address [env: MAILTUTAN_IPADDR=] [default: 0.0.0.0]
--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
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.