{"id":22281826,"url":"https://github.com/mistralmail/mistralmail","last_synced_at":"2026-01-15T22:18:39.658Z","repository":{"id":30276881,"uuid":"33828377","full_name":"mistralmail/mistralmail","owner":"mistralmail","description":"Mailserver written in Go","archived":false,"fork":false,"pushed_at":"2025-02-09T13:53:06.000Z","size":8709,"stargazers_count":79,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-01-13T04:12:18.533Z","etag":null,"topics":["go","golang","imap","mail","mail-server","msa","mta","selfhosted","smtp"],"latest_commit_sha":null,"homepage":"https://mistralmail.be","language":"Go","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/mistralmail.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":"2015-04-12T18:27:15.000Z","updated_at":"2025-11-04T23:53:52.000Z","dependencies_parsed_at":"2025-02-28T20:14:13.198Z","dependency_job_id":"402cd8ec-8654-4f6d-b3f3-3465202cbc35","html_url":"https://github.com/mistralmail/mistralmail","commit_stats":null,"previous_names":["mistralmail/mistralmail","gopistolet/gopistolet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mistralmail/mistralmail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistralmail%2Fmistralmail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistralmail%2Fmistralmail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistralmail%2Fmistralmail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistralmail%2Fmistralmail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mistralmail","download_url":"https://codeload.github.com/mistralmail/mistralmail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistralmail%2Fmistralmail/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28472626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T22:13:38.078Z","status":"ssl_error","status_checked_at":"2026-01-15T22:12:11.737Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["go","golang","imap","mail","mail-server","msa","mta","selfhosted","smtp"],"created_at":"2024-12-03T16:22:27.537Z","updated_at":"2026-01-15T22:18:39.642Z","avatar_url":"https://github.com/mistralmail.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](.github/assets/mistralmail128.png)\n\n# MistralMail\n\nMistralMail will be a production-ready, and easy to setup mail server. It consists of an SMTP server (both MSA and MTA) and an IMAP server all bundled in one executable (or just in one Docker image) with auto-generated TLS certificates.\n\n⚠️ **WIP: MistralMail is far from being production-ready!** ⚠️\n\n\n\n## Usage\n\n### Setting up DNS records\n\nMistralMail will not be able to generate TLS certificates without a correct DNS configuration. And of course you also won't be able to receive any emails. (But if you just want to configure it locally you can set `TLS_DISABLE` to `true` and skip this section.)\n\nYou need the following DNS records:\n\n- A record `imap.yourdomain.com` pointing to your MistralMail server ip.\n- A record `mx.yourdomain.com` pointing to your MistralMail server ip.\n- A record `smtp.yourdomain.com` pointing to your MistralMail server ip.\n- MX record point to `mx.yourdomain.com`.\n- SPF record pointing to your SMTP relay provider.\n\n### Running the MistralMail server\n\nFirst you need to copy `.env.sample` to `.env` and configure all the needed environment variables.\n\nWhen using HTTP challenge for TLS: make sure that ports 80 and 443 are opened for the automatic TLS certificate generation via Let's Encrypt.\n\nThen you can run the Go main manually or with Docker.\n\n**Go:**\n\n```bash\nsource .env\ngo run cmd/mistralmail/*.go\n```\n\n**Docker:**\n\nEverything needed is put into the `docker-compose.yml` file.\nIf you don't want to build the image yourself you can use the prebuilt one present at `denbeke/mistralmail`.\n\n```bash\ndocker-compose up mistralmail\n```\n\nNow you can create a user with the MistralMail CLI.\n\nMistralMail exposes the following ports:\n\n- `25` for all incoming SMTP emails (MTA)\n- `587` for all outing SMTP emails (MSA)\n- `143` for IMAP\n- (`443` \u0026 `80` for Let's Encrypt, when not using DNS challenge)\n- `9000` for the metrics\n- `8080` for the api \u0026 web server\n\n###  Environment Variables\n\n| ENV                                   | Default value | Description |\n| ------------------------------------- | ------------- | ----------- |\n| `HOSTNAME`                            |               | Hostname of the MistralMail mail server |\n| `SMTP_ADDRESS_INCOMING`               | `:25` | Bind address for the listener of incoming email. |\n| `SMTP_ADDRESS_OUTGOING`               | `:587` | Bind address for the listener of outgoing email. |\n| `IMAP_ADDRESS`                        | `:143` | Bind address for the listener of IMAP. |\n| `DATABASE_URL`                        | `sqlite:test.db` | Database connection url.\u003cbr /\u003eExample using Postgres: `postgresql://user:pass@localhost/mydatabase`.\u003cbr /\u003eIt defaults to a local Sqlite database. |\n| `SUBDOMAIN_INCOMING`                  | `mx.{HOSTNAME}` | Domain for the incoming mail. |\n| `SUBDOMAIN_OUTGOING`                  | `smtp.{HOSTNAME}` | Domain for the outgoing mail. |\n| `SUBDOMAIN_IMAP`                      | `imap.{HOSTNAME}` | Domain for IMAP. |\n| `SMTP_OUTGOING_MODE`                  | `RELAY` | Mode for delivering outgoing mail. Currently only `RELAY` mode is supported. So this means you have to configure an SMTP relay for sending out emails. |\n| `EXTERNAL_RELAY_HOSTNAME`             |               | Hostname of the SMTP relay. |\n| `EXTERNAL_RELAY_PORT`                 |               | Port of the SMTP relay. |\n| `EXTERNAL_RELAY_USERNAME`             |               | Username of the SMTP relay. |\n| `EXTERNAL_RELAY_PASSWORD`             |               | Password  of the SMTP relay. |\n| `EXTERNAL_RELAY_INSECURE_SKIP_VERIFY` | `false` | Allow insecure connections to the SMTP relay. |\n| `TLS_DISABLE`                         | `false` | Disable TLS for the MistralMail server. |\n| `TLS_ACME_CHALLENGE`                  |               | Type of the ACME challenge supports two types:\u003cbr /\u003e- `HTTP`: standard HTTP ACME challenge (need to open port 443 and 80 for this)\u003cbr /\u003e- `DNS`: challenge by DNS. Need to provide `TLS_ACME_DNS_PROVIDER` for this and configure the [DNS provider API credentials](https://go-acme.github.io/lego/dns/). |\n| `TLS_ACME_EMAIL`                      |               | Email of the Let's Encrypt account. |\n| `TLS_ACME_ENDPOINT`                   | `https://acme-v02.api.letsencrypt.org/directory` | Let's Encrypt endpoint. By default we use the production endpoint. If you want to test your configuration it is advised to test against staging to avoid rate limits: `https://acme-staging-v02.api.letsencrypt.org/directory` |\n| `TLS_ACME_DNS_PROVIDER`               |               | [DNS provider](https://go-acme.github.io/lego/dns/) to be used for Let's Encrypt. |\n| `TLS_CERTIFICATES_DIRECTORY`          | `./certificates` | Directory where TLS certificates are stored. |\n| `HTTP_ADDRESS`                        | `:8080` | Address of the webserver that serves the web interface and the API. |\n| `SECRET`                              |               | Encryption secret. |\n| `SENTRY_DSN`                          |               | Sentry DNS if you want to log errors to Sentry. |\n| `LOG_FULL_QUERIES`                    | `false`       | Log all queries with their parameters. |\n| `SPAM_CHECK_ENABLE`                   | `false` | Enable the very basic spam check. Note that it sends all incoming messages to the [Postmark Spam Check API](https://spamcheck.postmarkapp.com). |\n| `METRICS_ADDRESS`                     | `:9000` | Prometheus metrics address. |\n\n\n\n### Using the MistralMail Web UI\n\nMistralMail comes with a basic web ui `http://localhost:8080`.\nAt the moment it supports nothing more than basic user management and basic statistics.\n\n![mistralmail-web-ui](.github/assets/mistralmail-web-ui.png)\n\n### Using the MistralMail command line interface\n\nYou can use the MistralMail command line interface with Go or with Docker:\n\n```bash\ngo run cmd/mistralmail-cli/*.go\n```\n\nor\n\n```bash\ndocker-compose run mistralmail mistralmail-cli\n```\n\nCurrently the CLI contains the following commands:\n\n- `create-user`: to create a new user.\n\n- `reset-password` to reset the password of a user.\n\n### Configuring your mail client\n\n**IMAP:**\n\n- **Server address:** `imap.yourdomain.com`\n\n- **Username:** your email address\n\n- **Port:** 143\n\n- **Security:** STARTTLS\n\n- **Authentication:** password\n\n**SMTP:**\n\n- **Server address:** `smtp.yourdomain.com`\n\n- **Username:** your email address\n\n- **Port:** 587\n\n- **Security:** STARTTLS\n\n- **Authentication:** password\n\n\n\nNow you're all good to go!\n\n\n\n## Development\n\nWe use `go work` for updating files across multiple repo's:\n\n```bash\ngo work init\ngo work use smtp\ngo work use imap-backend\n```\n\n\n\n## Current state of MistralMail\n\n### SMTP server\n\nThe SMTP server is completely custom written and can be found here: [mistralmail/smtp](https://github.com/mistralmail/smtp). It was written quite a while ago but it seems robust enough for now.\n\nFor outgoing emails we currently only support using an external relay like Mailgun or Sendgrid since we don't want to put too much time into debugging an MSA.\n\n### IMAP\n\nFor IMAP we wrote a SQL backend behind [go-imap](https://github.com/emersion/go-imap). It supports MySQL, Postgres and Sqlite. (Currently only Sqlite has actually been tested.)\n\nThis backend is very experimental and surely contains a lot of bug. The backend is also implemented in a very non-performant way. So don't expect that MistralMail will be able to handle large inboxes at its current state.\n\nWe dump the complete emails in the database at this moment. In the future we would like to add support for object storage for the actual mail bodies. But that's nothing for the near future.\n\n### Webmail\n\nCurrently there are no concrete plans to implement a webmail. But wouldn't it be nice to have it someday?\n\n### Web management\n\nInstead of configuring everything via a CLI, it's also possible to use the very basic web ui. But this is still very basic.\n\n### SPAM\n\nAnother feature we are also not working on currently is anti-spam. Only SPF is checked at the moment. But nothing else.  \nA very basic `X-Spam-Score` header can be enabled by setting `SPAM_CHECK_ENABLE` to `true`. It is disabled by default because it sends the incoming messages to the [Postmark Spam Check API](https://spamcheck.postmarkapp.com).\n\n\n\n## Acknowledgements\n\n* [Testify](https://github.com/stretchr/testify)\n* [GoConvey](https://github.com/smartystreets/goconvey)\n* [go-imap](https://github.com/emersion/go-imap)\n* [logrus_sentry](https://github.com/evalphobia/logrus_sentry)\n\n\n\n## Authors\n\n[Mathias Beke](https://denbeke.be)\nTimo Truyts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistralmail%2Fmistralmail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmistralmail%2Fmistralmail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistralmail%2Fmistralmail/lists"}