https://github.com/mjl-/mox Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} mjl- / mox Public * Notifications * Fork 20 * Star 1.2k modern full-featured open source secure mail server for low-maintenance self-hosted email License MIT license 1.2k stars 20 forks Star Notifications * Code * Issues 3 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights mjl-/mox This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 1 tag Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/m] Use Git or checkout with SVN using the web URL. [gh repo clone mjl-/m] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @mjl- mjl- umask logging line tweak ... 210fd34 Feb 22, 2023 umask logging line tweak 210fd34 Git stats * 61 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .go autotls config dkim dmarc dmarcdb dmarcrpt dns dnsbl dsn http imapclient imapserver iprev junk message metrics mlog mox- moxio moxvar mtasts mtastsdb publicsuffix queue ratelimit rfc scram smtp smtpclient smtpserver spf store subjectpass testdata tlsrpt tlsrptdb updates vendor .dockerignore .gitignore .jshintrc Dockerfile Dockerfile.imaptest LICENSE.MIT LICENSE.MPLv2.0 Makefile README.md checkhtmljs compatibility.txt ctl.go doc.go docker-compose-imaptest.yml docker-compose-integration.yml export.go gendoc.sh go.mod go.sum import.go integration_test.go junk.go main.go mox.service quickstart.go serve.go start.go tools.go updates.go View code [ ] Download Quickstart FAQ - Frequently Asked Questions Why a new mail server implementation? Where is the documentation? How do I import/ export email? How can I help? How do I change my password? How do I configure a second mox instance as a backup MX? How secure is mox? README.md Mox is a modern full-featured open source secure mail server for low-maintenance self-hosted email. See Quickstart below to get started. Mox features: * Quick and easy to start/maintain mail server, for your own domain (s). * SMTP (with extensions) for receiving and submitting email. * IMAP4 (with extensions) for giving email clients access to email. * Automatic TLS with ACME, for use with Let's Encrypt and other CA's. * SPF, verifying that a remote host is allowed to sent email for a domain. * DKIM, verifying that a message is signed by the claimed sender domain, and for signing emails sent by mox for others to verify. * DMARC, for enforcing SPF/DKIM policies set by domains. Incoming DMARC aggregate reports are analyzed. * Reputation tracking, learning (per user) host- and domain-based reputation from (Non-)Junk email. * Bayesian spam filtering that learns (per user) from (Non-)Junk email. * Slowing down senders with no/low reputation or questionable email content (similar to greylisting). Rejected emails are stored in a mailbox called Rejects for a short period, helping with misclassified legitimate synchronous signup/login/transactional emails. * Internationalized email, with unicode names in domains and usernames ("localparts"). * TLSRPT, parsing reports about TLS usage and issues. * MTA-STS, for ensuring TLS is used whenever it is required. Both serving of policies, and tracking and applying policies of remote servers. * Web admin interface that helps you set up your domains and accounts (instructions to create DNS records, configure SPF/DKIM/ DMARC/TLSRPT/MTA-STS), for status information, managing accounts/ domains, and modifying the configuration file. * Autodiscovery (with SRV records, Microsoft-style and Thunderbird-style) for easy account setup (though not many clients support it). * Prometheus metrics and structured logging for operational insight. Not supported (but perhaps in the future): * Webmail * HTTP-based API for sending messages and receiving delivery feedback * Calendaring * Functioning as SMTP relay * Forwarding (to an external address) * Autoresponders * POP3 * Delivery to (unix) OS system users * Sieve for filtering * PGP or S/MIME * Mailing list manager * Support for pluggable delivery mechanisms. Mox has automated tests, including for interoperability with Postfix for SMTP. Mox is manually tested with email clients: Mozilla Thunderbird, mutt, iOS Mail, macOS Mail, Android Mail, Microsoft Outlook. Mox is also manually tested to interoperate with popular cloud providers: gmail.com, outlook.com, yahoo.com, proton.me. Mox is implemented in Go, a modern safe programming language, and has a focus on security. Mox is available under the MIT-license. Mox includes the Public Suffix List by Mozilla, under Mozilla Public License, v. 2.0. Mox was created by Mechiel Lukkien, mechiel@ueber.net. For discussions/talk, join #mox on irc.oftc.net, or #mox on the "Gopher slack". Download You can easily (cross) compile mox if you have a recent Go toolchain installed (see "go version", it must be >= 1.19; otherwise, see https://go.dev/dl/ or https://go.dev/doc/manage-install and $HOME/go/ bin): GOBIN=$PWD go install github.com/mjl-/mox@latest Or you can download a binary built with the latest Go toolchain from https://beta.gobuilds.org/github.com/mjl-/mox, and symlink or rename it to "mox". Verify you have a working mox binary: ./mox version Note: Mox only compiles/works on unix systems, not on Plan 9 or Windows. Quickstart The easiest way to get started with serving email for your domain is to get a vm/machine dedicated to serving email, name it [host]. [domain], login as an admin user, e.g. /home/service, download mox, and generate a configuration for your desired email address at your domain: ./mox quickstart you@example.com This creates an account, generates a password and configuration files, prints the DNS records you need to manually create and prints commands to set permissions and install mox as a service. If you already have email configured for your domain, or if you are already sending email for your domain from other machines/services, you should modify the suggested configuration and/or DNS records. A dedicated machine is highly recommended because modern email requires HTTPS, also for automatic TLS. You can combine mox with an existing webserver, but it requires more configuration. After starting, you can access the admin web interface on internal IPs. FAQ - Frequently Asked Questions Why a new mail server implementation? Mox aims to make "running a mail server" easy and nearly effortless. Excellent quality mail server software exists, but getting a working setup typically requires you configure half a dozen services (SMTP, IMAP, SPF/DKIM/DMARC, spam filtering). That seems to lead to people no longer running their own mail servers, instead switching to one of the few centralized email providers. Email with SMTP is a long-time decentralized messaging protocol. To keep it decentralized, people need to run their own mail server. Mox aims to make that easy. Where is the documentation? See all commands and help text at https://pkg.go.dev/github.com/mjl-/ mox/, and example config files at https://pkg.go.dev/github.com/mjl-/ mox/config/. You can get the same information by running "mox" without arguments to list its subcommands and usage, and "mox help [subcommand]" for more details. The example config files are printed by "mox config describe-static" and "mox config describe-dynamic". Mox is still in early stages, and documentation is still limited. Please create an issue describing what is unclear or confusing, and we'll try to improve the documentation. How do I import/export email? Use the import functionality on the accounts web page to import a zip /tgz with maildirs/mbox files, or use the "mox import maildir" or "mox import mbox" subcommands. You could also use your IMAP email client, add your mox account, and copy or move messages from one account to the other. Similarly, see the export functionality on the accounts web page and the "mox export maildir" and "mox export mbox" subcommands to export email. How can I help? Mox needs users and testing in real-life setups! So just give it a try, send and receive emails through it with your favourite email clients, and file an issue if you encounter a problem or would like to see a feature/functionality implemented. Instead of switching your email for your domain over to mox, you could simply configure mox for a subdomain, e.g. [you]@moxtest. [yourdomain]. If you have experience with how the email protocols are used in the wild, e.g. compatibility issues, limitations, anti-spam measures, specification violations, that would be interesting to hear about. Pull requests for bug fixes and new code are welcome too. If the changes are large, it helps to start a discussion (create a ticket) before doing all the work. How do I change my password? Regular users (doing IMAP/SMTP with authentication) can change their password at the account page, e.g. http://127.0.0.1/. Or you can set a password with "mox setaccountpassword". The admin password can be changed with "mox setadminpassword". How do I configure a second mox instance as a backup MX? Unfortunately, mox does not yet provide an option for that. Mox does spam filtering based on reputation of received messages. It will take a good amount of work to share that information with a backup MX. Without that information, spammer could use a backup MX to get their spam accepted. Until mox has a proper solution, you can simply run a single SMTP server. How secure is mox? Security is high on the priority list for mox. Mox is young, so don't expect no bugs at all. Mox does have automated tests for some security aspects, e.g. for login, and uses fuzzing. Mox is written in Go, so some classes of bugs such as buffer mishandling do not typically result in privilege escalation. Of course logic bugs will still exist. If you find any security issues, please email them to mechiel@ueber.net. About modern full-featured open source secure mail server for low-maintenance self-hosted email Resources Readme License MIT license Stars 1.2k stars Watchers 15 watching Forks 20 forks Releases 1 tags Packages 0 No packages published Languages * Go 95.3% * HTML 4.4% * Other 0.3% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.