{"id":17641601,"url":"https://github.com/jginsburgn/mail-server","last_synced_at":"2026-04-28T20:04:57.604Z","repository":{"id":89618596,"uuid":"264857541","full_name":"jginsburgn/mail-server","owner":"jginsburgn","description":"A dockerized SMTP \u0026 IMAP server.","archived":false,"fork":false,"pushed_at":"2020-05-18T07:15:08.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-30T05:26:28.493Z","etag":null,"topics":["docker-image","imap-server","smtp-server"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jginsburgn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-05-18T07:12:42.000Z","updated_at":"2021-11-29T03:49:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"bd2afe57-fa0c-4793-90f5-e1b31c49b5d6","html_url":"https://github.com/jginsburgn/mail-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jginsburgn/mail-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jginsburgn%2Fmail-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jginsburgn%2Fmail-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jginsburgn%2Fmail-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jginsburgn%2Fmail-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jginsburgn","download_url":"https://codeload.github.com/jginsburgn/mail-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jginsburgn%2Fmail-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32396802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: 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":["docker-image","imap-server","smtp-server"],"created_at":"2024-10-23T07:07:07.942Z","updated_at":"2026-04-28T20:04:57.580Z","avatar_url":"https://github.com/jginsburgn.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SMTP/IMAP Server in a Docker Image\n\nThis image combines postfix and dovecot into a secure IMAP/SMTP server. The server is enabled with virtual users, each with its own maildir. Also, it has spamassassin to detect junk email and sieve to route such emails to their proper place (the Junk mailbox).\n\nSASL in SMTP (outgoing email) refers to relay service authentication. In other words, it is used to authenticate to an MTA (commonly SendGrid) when a user wants to send a message to a third party.\n\nSASL in SMTPD (incoming email) refers to SMTP client authentication. It is used when mail clients want to send email through this server.\n\n## Postfix\n\nPostfix is the main workhorse for receiving mail through SMTP and delivering it locally (LMTP) or remotely (SMTP).\n\n## Dovecot\n\nDovecot serves postfix to:\n\n- authenticate SMTP users via SASL\n- write local delivery email to maildirs\n- serve maildirs via IMAP\n- with sieve, it places spam-marked in the Junk mailbox\n\n## Spamassassin\n\nSpamassassin works as an [`after-queue filter`](http://www.postfix.org/FILTER_README.html) for postfix.\n\n## TLS\n\nAll exposed services in this image rely on TLS. Therefore, a certificate in PEM format and its key should be located at `etc/ssl/cert.pem` and `/etc/ssl/key.pem`, respectively.\n\n## Relevant Configurations\n\nAfter a modification to one of the files do: `service dovecot restart`, `service postfix restart` or `service spamassassin restart` as needed. Most relevant configuration files are:\n\n### `/etc/postfix/↴`\n\n#### [`aliases`](http://www.postfix.org/virtual.5.html)\n\nAddress rewriting for delivery. This is used in order to map a recipient to another, set a catchall address and create a mailing list.\n\nExample:\n\n```\n# Mailing list\nsupport@example.com adam@example.com,bob@example.com\n\n# Domain catchall address\n@example.com adam@example.com\n\n# Alias\nadam@example.com bob@example.com\n```\n\nAfter modyfing do:\n\n```\ncd /etc/postfix\npostmap aliases\n```\n\n#### `domains`\n\nDomains that are final destination for this SMTP server. The in the table key is the domain; note that the value in the table is not used.\n\nExample:\n\n```\nexample1.com .\nexample2.com .\nexample3.com .\n```\n\nAfter modyfing do:\n\n```\ncd /etc/postfix\npostmap domains\n```\n\n#### `mailboxes`\n\nUsers for the corresponding domains that have mailboxes. The key in the table is the user; note that the value in the table is not used.\n\nExample:\n\n```\nadam@example1.com adam\nbob@example2.com bo\n```\n\nAfter modyfing do:\n\n```\ncd /etc/postfix\npostmap mailboxes\n```\n\n#### `relay-sasl`\n\nThe authentication credentials for relay hosts. Entries are of the form:\n\n```\n[smtp.google.net]:587 username:password\n```\n\nAfter modyfing do:\n\n```\ncd /etc/postfix\npostmap relay-sasl\n```\n\n#### `master.cf`\n\nThe service definition file for postfix.\n\n#### `main.cf`\n\n- `hostname`: a string for greeting clients (e.g. `example.com`)\n- `relayhost`: the relay destination (e.g. [smtp.sendgrid.net]:587)\n- `virtual_mailbox_domains`: a space separated list of domains for receiving email (e.g. `example.com example1.com`)\n\n### `/etc/dovecot/conf.d/↴`\n\n#### `10-auth.conf`\n\nAuthentication processes.\n\n#### `10-logging.conf`\n\nLog destination.\n\n#### `10-mail.conf`\n\nMailbox locations and namespaces.\n\n#### `10-master.conf`\n\nServices configuration (e.g. LMTP, IMAP, etc.).\n\n#### `10-ssl.conf`\n\nSSL settings.\n\n#### `15-mailboxes.conf`\n\nMailbox definitions.\n\n#### `20-lmtp.conf`\n\nLMTP specific settings.\n\n#### `90-plugin.conf`\n\nPlugin settings.\n\n#### `90-sieve.conf`\n\nSettings for the Sieve interpreter.\n\n#### `auth-passwdfile.conf.ext`\n\nAuthentication for passwd-file users.\n\n### `/etc/dovecot/↴`\n\n#### `dovecot.conf`\n\nConfiguration entry point for Dovecot.\n\n#### `users`\n\nIncoming mail SASL database. Format is comparable to that of `/etc/passwd` files.\n\n### `/etc/dovecot/sieve/↴`\n\n#### `default.sieve`\n\nA sieve script to deliver spam email (marked by spamassassin) to the corresponding user mailbox (i.e. Junk).\n\n## Migrating existing maildirs\n\nJust copy the contents of the `cur` subdirectories in the source Mailbox to the target (do not forget to use `-p` to preserve timestamps and then `chown -R dovecot:dovecot` to fix user conflicts):\n\n```bash\ncp -p source/mailbox/.spam/cur/* target/mailbox/.Spam/cur\nchown -R dovecot:dovecot target/mailbox\n```\n\n## Testing an SMTP with TLS session\n\nRun `openssl` follows:\n\n```\nopenssl s_client -starttls smtp -crlf -quiet -connect example.com:587\n```\n\nAnd, complete an `SMTP` session as follows:\n\n```\nHELO example1.com\n250 example.com\nMAIL FROM: \u003cadam@example1.com\u003e\n250 2.1.0 Ok\nRCPT TO: \u003cbob@exmaple.com\u003e\n250 2.1.5 Ok\nDATA\n354 End data with \u003cCR\u003e\u003cLF\u003e.\u003cCR\u003e\u003cLF\u003e\nFrom: Adam Doe \u003cadam@example.com\u003e\nTo: Bob Adams \u003cbob@example1.com\u003e\nSubject: What is this?\nIt is an email, duh!\n.\n250 2.0.0 Ok: queued as 969DE121947\nQUIT\n221 2.0.0 Bye\n```\n\n## TODOs\n\n- Use [cAdvisor](https://github.com/google/cadvisor) to monitor docker processes.\n- Make postfix and dovecot logs show in the entrypoint process, instead of in files under `/var/log`.\n- Make sieve deliver `+`-recipients (e.g. john+work@example.com) to corresponding mailboxes (i.e. Work in the example).\n- Protect sender aliasing: https://serverfault.com/questions/797995/postfix-allow-sending-email-with-related-alias\n\n## References\n\n- [Nestor de Haro's post in Digital Ocean](https://www.digitalocean.com/community/tutorials/how-to-configure-a-mail-server-using-postfix-dovecot-mysql-and-spamassassin#-step-4-configure-dovecot)\n- [Integrating SendGrid with postfix](https://sendgrid.com/docs/for-developers/sending-email/postfix/)\n- [postfix docs](http://www.postfix.org/documentation.html)\n- [Dovecot docs](https://doc.dovecot.org/)\n- [Spamassassin tutorial](https://hostadvice.com/how-to/how-to-secure-postfix-with-spamassassin-on-an-ubuntu-18-04-vps-or-dedicated-server/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjginsburgn%2Fmail-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjginsburgn%2Fmail-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjginsburgn%2Fmail-server/lists"}