2021-01-16 09:16:05 +00:00
# Docker Mailserver
2016-06-25 08:57:46 +00:00
2021-04-01 20:44:31 +00:00
[![ci::status]][ci::github] [![docker::pulls]][docker::hub] [![documentation::badge]][documentation::web]
2020-12-22 10:08:50 +00:00
2022-12-23 13:32:06 +00:00
[ci::status]: https://img.shields.io/github/actions/workflow/status/docker-mailserver/docker-mailserver/default_on_push.yml?branch=master& color=blue& label=CI& logo=github& logoColor=white& style=for-the-badge
2021-01-16 09:16:05 +00:00
[ci::github]: https://github.com/docker-mailserver/docker-mailserver/actions
[docker::pulls]: https://img.shields.io/docker/pulls/mailserver/docker-mailserver.svg?style=for-the-badge& logo=docker& logoColor=white
[docker::hub]: https://hub.docker.com/r/mailserver/docker-mailserver/
2021-04-01 20:44:31 +00:00
[documentation::badge]: https://img.shields.io/badge/DOCUMENTATION-GH%20PAGES-0078D4?style=for-the-badge& logo=git& logoColor=white
[documentation::web]: https://docker-mailserver.github.io/docker-mailserver/edge/
2020-12-19 12:17:48 +00:00
2022-02-23 17:22:44 +00:00
A production-ready fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.). Only configuration files, no SQL database. Keep it simple and versioned. Easy to [deploy ](#usage ) and upgrade. [Documentation][documentation::web] via MkDocs.
Originally created by @tomav , docker-mailserver is now maintained by volunteers since January 2021.
2015-03-28 15:44:40 +00:00
2021-04-01 20:44:31 +00:00
If you have issues, read the full `README` **and** the [documentation][documentation::web] **for your version** (default is `edge` ) first **before opening an issue** . The issue tracker is for issues, not for personal support.
2020-09-09 15:19:48 +00:00
2021-01-16 09:16:05 +00:00
1. [Included Services ](#included-services )
2021-07-10 22:33:36 +00:00
2. [Issues and Contributing ](https://docker-mailserver.github.io/docker-mailserver/edge/contributing/issues-and-pull-requests/ )
2021-01-16 09:16:05 +00:00
3. [Requirements ](#requirements )
4. [Usage ](#usage )
5. [Examples ](#examples )
2021-05-11 10:15:34 +00:00
6. [Environment Variables ](https://docker-mailserver.github.io/docker-mailserver/edge/config/environment/ )
2021-04-01 20:44:31 +00:00
7. [Documentation][documentation::web]
8. [Release Notes ](./CHANGELOG.md )
2020-03-16 17:38:28 +00:00
2021-01-16 09:16:05 +00:00
## Included Services
2015-03-29 12:07:56 +00:00
2020-09-24 12:54:21 +00:00
- [Postfix ](http://www.postfix.org ) with SMTP or LDAP auth
2021-03-01 20:32:45 +00:00
- [Dovecot ](https://www.dovecot.org ) for SASL, IMAP (or POP3), with LDAP Auth, Sieve and [quotas ](https://docker-mailserver.github.io/docker-mailserver/edge/config/user-management/accounts#notes )
2019-08-31 07:15:42 +00:00
- [Amavis ](https://www.amavis.org/ )
2021-03-28 20:07:52 +00:00
- [SpamAssassin ](http://spamassassin.apache.org/ ) supporting custom rules
2019-08-31 07:15:42 +00:00
- [ClamAV ](https://www.clamav.net/ ) with automatic updates
- [OpenDKIM ](http://www.opendkim.org )
- [OpenDMARC ](https://github.com/trusteddomainproject/OpenDMARC )
- [Fail2ban ](https://www.fail2ban.org/wiki/index.php/Main_Page )
- [Fetchmail ](http://www.fetchmail.info/fetchmail-man.html )
- [Postscreen ](http://www.postfix.org/POSTSCREEN_README.html )
- [Postgrey ](https://postgrey.schweikert.ch/ )
2016-01-26 11:56:26 +00:00
- [LetsEncrypt ](https://letsencrypt.org/ ) and self-signed certificates
docs(chore): Normalize for consistency (#2206)
"Brief" summary/overview of changes. See the PR discussion or individual commits from the PR for more details.
---
Only applies to the `docs/content/**` content (_and `setup` command_). `target/` and `test/` can be normalized at a later date.
* Normalize to `example.com`
- Domains normalized to `example.com`: `mywebserver.com`, `myserver.tld`, `domain.com`, `domain.tld`, `mydomain.net`, `my-domain.tld`, `my-domain.com`, `example.org`, `whoami.com`.
- Alternative domains normalized to `not-example.com`: `otherdomain.com`, `otherdomain.tld`, `domain2.tld`, `mybackupmx.com`, `whoareyou.org`.
- Email addresses normalized to `admin@example.com` (in `ssl.md`): `foo@bar.com`, `yourcurrentemail@gmail.com`, `email@email.com`, `admin@domain.tld`.
- Email addresses normalized to `external-account@gmail.com`: `bill@gates321boom.com`, `external@gmail.com`, `myemail@gmail.com`, `real-email-address@external-domain.com`.
- **`faq.md`:** A FAQ entry title with `sample.domain.com` changed to `subdomain.example.com`.
- **`mail-fetchmail.md`:** Config examples with FQDNs for `imap`/`pop3` used `example.com` domain for a third-party, changed to `gmail.com` as more familiar third-party/external MTA.
* Normalize config volume path
- Normalizing local config path references to `./docker-data/dms/config/`: `./config/`, `config/`, \``config`\`, `/etc/` (_volume mount src path prefix_).
- Normalize DMS volume paths to `docker-data/dms/mail-{data,state,log}`: `./mail`, `./mail-state` `./data/mail`, `./data/state`, `./data/logs`, `./data/maildata`, `./data/mailstate`, `./data/maillogs`, (_dropped/converted data volumes: `maildata`, `mailstate`_).
- Other docker images also adopt the `docker-data/{service name}/` prefix.
* `ssl.md` - Use `dms/custom-certs` where appropriate.
* Apply normalizations to README and example `docker-compose.yml`
---
Common terms, sometimes interchangeably used or now invalid depending on context: `mail`, `mail container`, `mail server`, `mail-server`, `mailserver`,`docker-mailserver`, `Docker Mailserver`.
Rough transformations applied to most matches (_conditionally, depending on context_):
- 'Docker Mailserver' => '`docker-mailserver`'
- 'mail container' => '`docker-mailserver`' (_optionally retaining ' container'_)
- 'mail server' => 'mail-server' / '`docker-mailserver`'
- 'mail-server' => '`docker-mailserver`'
- 'mailserver' => 'mail-server' / '`docker-mailserver`'
Additionally I checked `docker run` (_plus `exec`, `logs`, etc, sub-commands_) and `docker-compose` commands. Often finding usage of `mail` instead of the expected `mailserver`
Additionally changes `mailserver` hostname in k8s to `mail` to align with other non-k8s examples.
---
* drive-by revisions
Mostly minor revisions or improvements to docs that aren't related to normalization effort.
2021-09-22 23:29:37 +00:00
- [Setup script ](https://docker-mailserver.github.io/docker-mailserver/edge/config/setup.sh ) to easily configure and maintain your mail-server
2021-03-01 20:32:45 +00:00
- Basic [Sieve support ](https://docker-mailserver.github.io/docker-mailserver/edge/config/advanced/mail-sieve ) using dovecot
2022-02-05 09:54:54 +00:00
- SASLauthd with LDAP auth (please see the note [down below ](#ldap-setup ))
2021-01-16 09:16:05 +00:00
- Persistent data and state
- [CI/CD ](https://github.com/docker-mailserver/docker-mailserver/actions )
- [Extension Delimiters ](http://www.postfix.org/postconf.5.html#recipient_delimiter ) (`you+extension@example.com` go to `you@example.com` )
2015-08-26 08:05:40 +00:00
2018-01-09 07:31:15 +00:00
## Requirements
2021-01-16 09:16:05 +00:00
**Recommended**:
2020-09-04 06:42:12 +00:00
2020-09-26 13:11:52 +00:00
- 1 Core
2021-02-23 19:03:01 +00:00
- 2GB RAM
2019-10-28 12:55:18 +00:00
- Swap enabled for the container
2018-01-09 07:31:15 +00:00
2021-01-16 09:16:05 +00:00
**Minimum**:
2020-09-04 06:42:12 +00:00
2020-09-26 13:11:52 +00:00
- 1 vCore
2018-01-09 07:31:15 +00:00
- 512MB RAM
2022-02-05 09:54:54 +00:00
- You'll need to deactivate some services like ClamAV to be able to run on a host with 512MB of RAM. Even with 1G RAM you may run into problems without swap, see [FAQ ](https://docker-mailserver.github.io/docker-mailserver/edge/faq/#what-system-requirements-are-required-to-run-docker-mailserver-effectively ).
2018-01-09 07:31:15 +00:00
2016-04-24 15:37:10 +00:00
## Usage
2015-03-31 15:28:13 +00:00
2021-06-01 10:17:14 +00:00
### Available Images / Tags - Tagging Convention
2021-01-24 22:18:37 +00:00
2021-04-01 20:44:31 +00:00
[CI/CD ](https://github.com/docker-mailserver/docker-mailserver/actions ) will automatically build, test and push new images to container registries. Currently, the following registries are supported:
2022-02-05 09:54:54 +00:00
1. [DockerHub ](https://hub.docker.com/r/mailserver/docker-mailserver )
2. [GitHub Container Registry ](https://github.com/orgs/docker-mailserver/packages?repo_name=docker-mailserver )
2021-01-24 22:18:37 +00:00
2021-06-01 10:17:14 +00:00
All workflows are using the tagging convention listed below. It is subsequently applied to all images.
2021-01-24 22:18:37 +00:00
2022-02-05 09:54:54 +00:00
| Event | Image Tags |
|--------------------|-------------------------------|
| `push` on `master` | `edge` |
| `push tag` | `1.2.3` , `1.2` , `1` , `latest` |
2016-04-20 08:15:51 +00:00
2022-02-05 09:54:54 +00:00
### Get the Tools
2018-03-07 18:33:43 +00:00
2022-02-05 09:54:54 +00:00
Since Docker Mailserver `v10.2.0` , ** `setup.sh` functionality is included within the container image**. The external convenience script is no longer required if you prefer using `docker exec <CONTAINER NAME> setup <COMMAND>` instead. **If you're new to `docker-mailserver`** , it is recommended to use the script `setup.sh` for convenience.
2021-02-18 13:00:51 +00:00
``` BASH
2021-09-11 23:29:02 +00:00
DMS_GITHUB_URL='https://raw.githubusercontent.com/docker-mailserver/docker-mailserver/master'
wget "${DMS_GITHUB_URL}/docker-compose.yml"
wget "${DMS_GITHUB_URL}/mailserver.env"
wget "${DMS_GITHUB_URL}/setup.sh"
2020-10-18 12:54:23 +00:00
chmod a+x ./setup.sh
2020-09-04 06:42:12 +00:00
```
2016-02-01 14:05:29 +00:00
2022-02-05 09:54:54 +00:00
### Create a docker-compose Environment
2018-02-07 18:37:26 +00:00
2021-05-11 10:15:34 +00:00
1. [Install the latest docker-compose ](https://docs.docker.com/compose/install/ )
2. Edit `docker-compose.yml` to your liking
docs(chore): Normalize for consistency (#2206)
"Brief" summary/overview of changes. See the PR discussion or individual commits from the PR for more details.
---
Only applies to the `docs/content/**` content (_and `setup` command_). `target/` and `test/` can be normalized at a later date.
* Normalize to `example.com`
- Domains normalized to `example.com`: `mywebserver.com`, `myserver.tld`, `domain.com`, `domain.tld`, `mydomain.net`, `my-domain.tld`, `my-domain.com`, `example.org`, `whoami.com`.
- Alternative domains normalized to `not-example.com`: `otherdomain.com`, `otherdomain.tld`, `domain2.tld`, `mybackupmx.com`, `whoareyou.org`.
- Email addresses normalized to `admin@example.com` (in `ssl.md`): `foo@bar.com`, `yourcurrentemail@gmail.com`, `email@email.com`, `admin@domain.tld`.
- Email addresses normalized to `external-account@gmail.com`: `bill@gates321boom.com`, `external@gmail.com`, `myemail@gmail.com`, `real-email-address@external-domain.com`.
- **`faq.md`:** A FAQ entry title with `sample.domain.com` changed to `subdomain.example.com`.
- **`mail-fetchmail.md`:** Config examples with FQDNs for `imap`/`pop3` used `example.com` domain for a third-party, changed to `gmail.com` as more familiar third-party/external MTA.
* Normalize config volume path
- Normalizing local config path references to `./docker-data/dms/config/`: `./config/`, `config/`, \``config`\`, `/etc/` (_volume mount src path prefix_).
- Normalize DMS volume paths to `docker-data/dms/mail-{data,state,log}`: `./mail`, `./mail-state` `./data/mail`, `./data/state`, `./data/logs`, `./data/maildata`, `./data/mailstate`, `./data/maillogs`, (_dropped/converted data volumes: `maildata`, `mailstate`_).
- Other docker images also adopt the `docker-data/{service name}/` prefix.
* `ssl.md` - Use `dms/custom-certs` where appropriate.
* Apply normalizations to README and example `docker-compose.yml`
---
Common terms, sometimes interchangeably used or now invalid depending on context: `mail`, `mail container`, `mail server`, `mail-server`, `mailserver`,`docker-mailserver`, `Docker Mailserver`.
Rough transformations applied to most matches (_conditionally, depending on context_):
- 'Docker Mailserver' => '`docker-mailserver`'
- 'mail container' => '`docker-mailserver`' (_optionally retaining ' container'_)
- 'mail server' => 'mail-server' / '`docker-mailserver`'
- 'mail-server' => '`docker-mailserver`'
- 'mailserver' => 'mail-server' / '`docker-mailserver`'
Additionally I checked `docker run` (_plus `exec`, `logs`, etc, sub-commands_) and `docker-compose` commands. Often finding usage of `mail` instead of the expected `mailserver`
Additionally changes `mailserver` hostname in k8s to `mail` to align with other non-k8s examples.
---
* drive-by revisions
Mostly minor revisions or improvements to docs that aren't related to normalization effort.
2021-09-22 23:29:37 +00:00
- substitute `mail` (hostname) and `example.com` (domainname) according to your FQDN
- if you want to use SELinux for the `./docker-data/dms/config/:/tmp/docker-mailserver/` mount, append `-z` or `-Z`
3. Configure the mailserver container to your liking by editing `mailserver.env` ([**Documentation**](https://docker-mailserver.github.io/docker-mailserver/edge/config/environment/)), but keep in mind this `.env` file:
- [_only_ basic `VAR=VAL` ](https://docs.docker.com/compose/env-file/ ) is supported (**do not** quote your values!)
2021-06-01 10:17:14 +00:00
- variable substitution is **not** supported (e.g. :no_entry_sign: `OVERRIDE_HOSTNAME=$HOSTNAME.$DOMAINNAME` :no_entry_sign:)
2020-01-18 10:42:23 +00:00
2022-02-09 09:25:09 +00:00
**Note:** If you're using podman, make sure to read the related [documentation ](https://docker-mailserver.github.io/docker-mailserver/edge/config/advanced/podman/ )
2020-09-24 12:54:21 +00:00
### Get up and running
2020-11-06 13:04:23 +00:00
2021-10-03 13:29:44 +00:00
#### First Things First
**Use `docker-compose up / down` , not `docker-compose start / stop` **. Otherwise, the container is not properly destroyed and you may experience problems during startup because of inconsistent state.
You are able to get a full overview of how the configuration works by either running:
1. `./setup.sh help` which includes the options of `setup.sh` .
2. `docker run --rm docker.io/mailserver/docker-mailserver:latest setup help` which provides you with all the information on configuration provided "inside" the container itself.
2022-02-05 09:54:54 +00:00
If no `docker-mailserver` container is running, any `./setup.sh` command will check online for the `:latest` image tag (the current _stable_ release), performing a `docker pull ...` if necessary followed by running the command in a temporary container.
``` CONSOLE
$ ./setup.sh help
Image 'docker.io/mailserver/docker-mailserver:latest' not found. Pulling ...
SETUP(1)
NAME
setup - 'docker-mailserver' Administration & Configuration script
...
$ docker run --rm docker.io/mailserver/docker-mailserver:latest setup help
SETUP(1)
NAME
setup - 'docker-mailserver' Administration & Configuration script
...
```
2021-10-03 13:29:44 +00:00
#### Starting for the first time
2022-04-18 08:48:48 +00:00
On first start, you will need to add at least one email account (unless you're using LDAP). You have two minutes to do so, otherwise DMS will shutdown and restart. You can add accounts with the following two methods:
2021-10-03 13:29:44 +00:00
2022-04-18 08:48:48 +00:00
1. Use `setup.sh` : `./setup.sh email add <user@domain>`
2. Run the command directly in the container: `docker exec -ti <CONTAINER NAME> setup email add <user@domain>`
2021-10-03 13:29:44 +00:00
You can then proceed by creating the postmaster alias and by creating DKIM keys.
2020-09-04 06:42:12 +00:00
``` BASH
2021-03-02 20:49:55 +00:00
docker-compose up -d mailserver
2020-11-06 13:04:23 +00:00
2021-10-03 13:29:44 +00:00
# you may add some more users
# for SELinux, use -Z
2021-04-01 20:44:31 +00:00
./setup.sh [-Z] email add < user @ domain > [< password > ]
2021-10-03 13:29:44 +00:00
# and configure aliases, DKIM and more
2021-04-01 20:44:31 +00:00
./setup.sh [-Z] alias add postmaster@< domain > < user @ domain >
2020-10-30 15:51:27 +00:00
```
2022-02-05 09:54:54 +00:00
### Miscellaneous
#### DNS - DKIM
You can (and you should) generate DKIM keys by running
2021-01-27 13:09:24 +00:00
``` BASH
2022-02-05 09:54:54 +00:00
./setup.sh [-Z] config dkim
2021-01-27 13:09:24 +00:00
```
2022-02-05 09:54:54 +00:00
If you want to see detailed usage information, run
2021-02-18 09:29:34 +00:00
2022-02-05 09:54:54 +00:00
``` BASH
./setup.sh config dkim help
```
2020-12-19 12:17:48 +00:00
2022-02-05 09:54:54 +00:00
In case you're using LDAP, the setup looks a bit different as you do not add user accounts directly. Postfix doesn't know your domain(s) and you need to provide it when configuring DKIM:
``` BASH
./setup.sh config dkim domain '< domain.tld > [,< domain2.tld > ]'
```
2020-11-06 13:04:23 +00:00
2021-04-01 20:44:31 +00:00
When keys are generated, you can configure your DNS server by just pasting the content of `config/opendkim/keys/domain.tld/mail.txt` to [set up DKIM ](https://mxtoolbox.com/dmarc/dkim/setup/how-to-setup-dkim ). See the [documentation ](https://docker-mailserver.github.io/docker-mailserver/edge/config/best-practices/dkim/ ) for more details.
2018-02-07 18:37:26 +00:00
2021-06-01 10:17:14 +00:00
#### Custom User Changes & Patches
2020-12-19 12:17:48 +00:00
2021-05-11 10:15:34 +00:00
If you'd like to change, patch or alter files or behavior of `docker-mailserver` , you can use a script. See the [documentation ](https://docker-mailserver.github.io/docker-mailserver/edge/config/advanced/override-defaults/user-patches/ ) for a detailed explanation.
docs(chore): Normalize for consistency (#2206)
"Brief" summary/overview of changes. See the PR discussion or individual commits from the PR for more details.
---
Only applies to the `docs/content/**` content (_and `setup` command_). `target/` and `test/` can be normalized at a later date.
* Normalize to `example.com`
- Domains normalized to `example.com`: `mywebserver.com`, `myserver.tld`, `domain.com`, `domain.tld`, `mydomain.net`, `my-domain.tld`, `my-domain.com`, `example.org`, `whoami.com`.
- Alternative domains normalized to `not-example.com`: `otherdomain.com`, `otherdomain.tld`, `domain2.tld`, `mybackupmx.com`, `whoareyou.org`.
- Email addresses normalized to `admin@example.com` (in `ssl.md`): `foo@bar.com`, `yourcurrentemail@gmail.com`, `email@email.com`, `admin@domain.tld`.
- Email addresses normalized to `external-account@gmail.com`: `bill@gates321boom.com`, `external@gmail.com`, `myemail@gmail.com`, `real-email-address@external-domain.com`.
- **`faq.md`:** A FAQ entry title with `sample.domain.com` changed to `subdomain.example.com`.
- **`mail-fetchmail.md`:** Config examples with FQDNs for `imap`/`pop3` used `example.com` domain for a third-party, changed to `gmail.com` as more familiar third-party/external MTA.
* Normalize config volume path
- Normalizing local config path references to `./docker-data/dms/config/`: `./config/`, `config/`, \``config`\`, `/etc/` (_volume mount src path prefix_).
- Normalize DMS volume paths to `docker-data/dms/mail-{data,state,log}`: `./mail`, `./mail-state` `./data/mail`, `./data/state`, `./data/logs`, `./data/maildata`, `./data/mailstate`, `./data/maillogs`, (_dropped/converted data volumes: `maildata`, `mailstate`_).
- Other docker images also adopt the `docker-data/{service name}/` prefix.
* `ssl.md` - Use `dms/custom-certs` where appropriate.
* Apply normalizations to README and example `docker-compose.yml`
---
Common terms, sometimes interchangeably used or now invalid depending on context: `mail`, `mail container`, `mail server`, `mail-server`, `mailserver`,`docker-mailserver`, `Docker Mailserver`.
Rough transformations applied to most matches (_conditionally, depending on context_):
- 'Docker Mailserver' => '`docker-mailserver`'
- 'mail container' => '`docker-mailserver`' (_optionally retaining ' container'_)
- 'mail server' => 'mail-server' / '`docker-mailserver`'
- 'mail-server' => '`docker-mailserver`'
- 'mailserver' => 'mail-server' / '`docker-mailserver`'
Additionally I checked `docker run` (_plus `exec`, `logs`, etc, sub-commands_) and `docker-compose` commands. Often finding usage of `mail` instead of the expected `mailserver`
Additionally changes `mailserver` hostname in k8s to `mail` to align with other non-k8s examples.
---
* drive-by revisions
Mostly minor revisions or improvements to docs that aren't related to normalization effort.
2021-09-22 23:29:37 +00:00
#### Updating `docker-mailserver`
2021-08-23 12:44:36 +00:00
2022-02-05 09:54:54 +00:00
**Make sure to read the [CHANGELOG ](https://github.com/docker-mailserver/docker-mailserver/blob/master/CHANGELOG.md )** before updating to new versions, to be prepared for possible breaking changes.
2021-05-11 10:15:34 +00:00
``` BASH
docker-compose pull
docker-compose down
docker-compose up -d mailserver
```
2021-08-29 00:19:57 +00:00
You should see the new version number on startup, for example: `[ TASKLOG ] Welcome to docker-mailserver 10.1.2` .
2021-08-23 12:44:36 +00:00
2021-05-11 10:15:34 +00:00
You're done! And don't forget to have a look at the remaining functions of the `setup.sh` script with `./setup.sh help` .
2020-09-04 06:42:12 +00:00
2020-11-25 12:31:21 +00:00
#### Supported Operating Systems
docs(chore): Normalize for consistency (#2206)
"Brief" summary/overview of changes. See the PR discussion or individual commits from the PR for more details.
---
Only applies to the `docs/content/**` content (_and `setup` command_). `target/` and `test/` can be normalized at a later date.
* Normalize to `example.com`
- Domains normalized to `example.com`: `mywebserver.com`, `myserver.tld`, `domain.com`, `domain.tld`, `mydomain.net`, `my-domain.tld`, `my-domain.com`, `example.org`, `whoami.com`.
- Alternative domains normalized to `not-example.com`: `otherdomain.com`, `otherdomain.tld`, `domain2.tld`, `mybackupmx.com`, `whoareyou.org`.
- Email addresses normalized to `admin@example.com` (in `ssl.md`): `foo@bar.com`, `yourcurrentemail@gmail.com`, `email@email.com`, `admin@domain.tld`.
- Email addresses normalized to `external-account@gmail.com`: `bill@gates321boom.com`, `external@gmail.com`, `myemail@gmail.com`, `real-email-address@external-domain.com`.
- **`faq.md`:** A FAQ entry title with `sample.domain.com` changed to `subdomain.example.com`.
- **`mail-fetchmail.md`:** Config examples with FQDNs for `imap`/`pop3` used `example.com` domain for a third-party, changed to `gmail.com` as more familiar third-party/external MTA.
* Normalize config volume path
- Normalizing local config path references to `./docker-data/dms/config/`: `./config/`, `config/`, \``config`\`, `/etc/` (_volume mount src path prefix_).
- Normalize DMS volume paths to `docker-data/dms/mail-{data,state,log}`: `./mail`, `./mail-state` `./data/mail`, `./data/state`, `./data/logs`, `./data/maildata`, `./data/mailstate`, `./data/maillogs`, (_dropped/converted data volumes: `maildata`, `mailstate`_).
- Other docker images also adopt the `docker-data/{service name}/` prefix.
* `ssl.md` - Use `dms/custom-certs` where appropriate.
* Apply normalizations to README and example `docker-compose.yml`
---
Common terms, sometimes interchangeably used or now invalid depending on context: `mail`, `mail container`, `mail server`, `mail-server`, `mailserver`,`docker-mailserver`, `Docker Mailserver`.
Rough transformations applied to most matches (_conditionally, depending on context_):
- 'Docker Mailserver' => '`docker-mailserver`'
- 'mail container' => '`docker-mailserver`' (_optionally retaining ' container'_)
- 'mail server' => 'mail-server' / '`docker-mailserver`'
- 'mail-server' => '`docker-mailserver`'
- 'mailserver' => 'mail-server' / '`docker-mailserver`'
Additionally I checked `docker run` (_plus `exec`, `logs`, etc, sub-commands_) and `docker-compose` commands. Often finding usage of `mail` instead of the expected `mailserver`
Additionally changes `mailserver` hostname in k8s to `mail` to align with other non-k8s examples.
---
* drive-by revisions
Mostly minor revisions or improvements to docs that aren't related to normalization effort.
2021-09-22 23:29:37 +00:00
We are currently providing support for Linux. Windows is _not_ supported and is known to cause problems. Similarly, macOS is _not officially_ supported - but you may get it to work there. In the end, Linux should be your preferred operating system for this image, especially when using this mail-server in production.
2020-11-25 12:31:21 +00:00
2021-05-11 10:15:34 +00:00
#### Bare Domains
If you want to use a bare domain (`hostname` == `domainname` ), see [FAQ ](https://docker-mailserver.github.io/docker-mailserver/edge/faq#can-i-use-nakedbare-domains-no-host-name ).
2020-11-25 12:31:21 +00:00
#### Support for Multiple Domains
`docker-mailserver` supports multiple domains out of the box, so you can do this:
``` BASH
./setup.sh email add user1@docker.example.com
./setup.sh email add user1@mail.example.de
./setup.sh email add user1@server.example.org
```
2018-03-18 19:15:06 +00:00
#### SPF/Forwarding Problems
If you got any problems with SPF and/or forwarding mails, give [SRS ](https://github.com/roehling/postsrsd/blob/master/README.md ) a try. You enable SRS by setting `ENABLE_SRS=1` . See the variable description for further information.
2021-04-01 20:44:31 +00:00
#### Ports
2020-04-27 06:23:32 +00:00
2021-04-01 20:44:31 +00:00
See the [documentation ](https://docker-mailserver.github.io/docker-mailserver/edge/config/security/understanding-the-ports/ ) for further details and best practice advice, **especially regarding security concerns** .
2018-02-18 12:12:39 +00:00
2021-06-22 22:28:43 +00:00
#### Mailboxes (_aka IMAP Folders_)
`INBOX` is setup by default with the special IMAP folders `Drafts` , `Sent` , `Junk` and `Trash` . You can learn how to modify or add your own folders (_including additional special folders like `Archive` _) by visiting our docs page [_Customizing IMAP Folders_][docs-examples-imapfolders] for more information.
[docs-examples-imapfolders]: https://docker-mailserver.github.io/docker-mailserver/edge/examples/use-cases/imap-folders
2020-09-09 15:19:48 +00:00
## Examples
2020-09-04 06:42:12 +00:00
2020-09-09 15:19:48 +00:00
### With Relevant Environmental Variables
2018-02-07 18:37:26 +00:00
2021-01-16 09:16:05 +00:00
This example provides you only with a basic example of what a minimal setup could look like. We **strongly recommend** that you go through the configuration file yourself and adjust everything to your needs. The default [docker-compose.yml ](./docker-compose.yml ) can be used for the purpose out-of-the-box, see the [usage section ](#usage ).
2020-11-25 12:31:21 +00:00
2020-09-09 15:19:48 +00:00
``` YAML
version: '3.8'
2016-09-07 17:39:27 +00:00
services:
2021-02-01 17:39:05 +00:00
mailserver:
2021-01-16 09:16:05 +00:00
image: docker.io/mailserver/docker-mailserver:latest
docs(chore): Normalize for consistency (#2206)
"Brief" summary/overview of changes. See the PR discussion or individual commits from the PR for more details.
---
Only applies to the `docs/content/**` content (_and `setup` command_). `target/` and `test/` can be normalized at a later date.
* Normalize to `example.com`
- Domains normalized to `example.com`: `mywebserver.com`, `myserver.tld`, `domain.com`, `domain.tld`, `mydomain.net`, `my-domain.tld`, `my-domain.com`, `example.org`, `whoami.com`.
- Alternative domains normalized to `not-example.com`: `otherdomain.com`, `otherdomain.tld`, `domain2.tld`, `mybackupmx.com`, `whoareyou.org`.
- Email addresses normalized to `admin@example.com` (in `ssl.md`): `foo@bar.com`, `yourcurrentemail@gmail.com`, `email@email.com`, `admin@domain.tld`.
- Email addresses normalized to `external-account@gmail.com`: `bill@gates321boom.com`, `external@gmail.com`, `myemail@gmail.com`, `real-email-address@external-domain.com`.
- **`faq.md`:** A FAQ entry title with `sample.domain.com` changed to `subdomain.example.com`.
- **`mail-fetchmail.md`:** Config examples with FQDNs for `imap`/`pop3` used `example.com` domain for a third-party, changed to `gmail.com` as more familiar third-party/external MTA.
* Normalize config volume path
- Normalizing local config path references to `./docker-data/dms/config/`: `./config/`, `config/`, \``config`\`, `/etc/` (_volume mount src path prefix_).
- Normalize DMS volume paths to `docker-data/dms/mail-{data,state,log}`: `./mail`, `./mail-state` `./data/mail`, `./data/state`, `./data/logs`, `./data/maildata`, `./data/mailstate`, `./data/maillogs`, (_dropped/converted data volumes: `maildata`, `mailstate`_).
- Other docker images also adopt the `docker-data/{service name}/` prefix.
* `ssl.md` - Use `dms/custom-certs` where appropriate.
* Apply normalizations to README and example `docker-compose.yml`
---
Common terms, sometimes interchangeably used or now invalid depending on context: `mail`, `mail container`, `mail server`, `mail-server`, `mailserver`,`docker-mailserver`, `Docker Mailserver`.
Rough transformations applied to most matches (_conditionally, depending on context_):
- 'Docker Mailserver' => '`docker-mailserver`'
- 'mail container' => '`docker-mailserver`' (_optionally retaining ' container'_)
- 'mail server' => 'mail-server' / '`docker-mailserver`'
- 'mail-server' => '`docker-mailserver`'
- 'mailserver' => 'mail-server' / '`docker-mailserver`'
Additionally I checked `docker run` (_plus `exec`, `logs`, etc, sub-commands_) and `docker-compose` commands. Often finding usage of `mail` instead of the expected `mailserver`
Additionally changes `mailserver` hostname in k8s to `mail` to align with other non-k8s examples.
---
* drive-by revisions
Mostly minor revisions or improvements to docs that aren't related to normalization effort.
2021-09-22 23:29:37 +00:00
container_name: mailserver
2021-05-11 10:15:34 +00:00
hostname: mail
domainname: example.com
2016-09-07 17:39:27 +00:00
ports:
2019-05-05 18:22:51 +00:00
- "25:25"
- "143:143"
- "587:587"
- "993:993"
2016-04-24 15:37:10 +00:00
volumes:
docs(chore): Normalize for consistency (#2206)
"Brief" summary/overview of changes. See the PR discussion or individual commits from the PR for more details.
---
Only applies to the `docs/content/**` content (_and `setup` command_). `target/` and `test/` can be normalized at a later date.
* Normalize to `example.com`
- Domains normalized to `example.com`: `mywebserver.com`, `myserver.tld`, `domain.com`, `domain.tld`, `mydomain.net`, `my-domain.tld`, `my-domain.com`, `example.org`, `whoami.com`.
- Alternative domains normalized to `not-example.com`: `otherdomain.com`, `otherdomain.tld`, `domain2.tld`, `mybackupmx.com`, `whoareyou.org`.
- Email addresses normalized to `admin@example.com` (in `ssl.md`): `foo@bar.com`, `yourcurrentemail@gmail.com`, `email@email.com`, `admin@domain.tld`.
- Email addresses normalized to `external-account@gmail.com`: `bill@gates321boom.com`, `external@gmail.com`, `myemail@gmail.com`, `real-email-address@external-domain.com`.
- **`faq.md`:** A FAQ entry title with `sample.domain.com` changed to `subdomain.example.com`.
- **`mail-fetchmail.md`:** Config examples with FQDNs for `imap`/`pop3` used `example.com` domain for a third-party, changed to `gmail.com` as more familiar third-party/external MTA.
* Normalize config volume path
- Normalizing local config path references to `./docker-data/dms/config/`: `./config/`, `config/`, \``config`\`, `/etc/` (_volume mount src path prefix_).
- Normalize DMS volume paths to `docker-data/dms/mail-{data,state,log}`: `./mail`, `./mail-state` `./data/mail`, `./data/state`, `./data/logs`, `./data/maildata`, `./data/mailstate`, `./data/maillogs`, (_dropped/converted data volumes: `maildata`, `mailstate`_).
- Other docker images also adopt the `docker-data/{service name}/` prefix.
* `ssl.md` - Use `dms/custom-certs` where appropriate.
* Apply normalizations to README and example `docker-compose.yml`
---
Common terms, sometimes interchangeably used or now invalid depending on context: `mail`, `mail container`, `mail server`, `mail-server`, `mailserver`,`docker-mailserver`, `Docker Mailserver`.
Rough transformations applied to most matches (_conditionally, depending on context_):
- 'Docker Mailserver' => '`docker-mailserver`'
- 'mail container' => '`docker-mailserver`' (_optionally retaining ' container'_)
- 'mail server' => 'mail-server' / '`docker-mailserver`'
- 'mail-server' => '`docker-mailserver`'
- 'mailserver' => 'mail-server' / '`docker-mailserver`'
Additionally I checked `docker run` (_plus `exec`, `logs`, etc, sub-commands_) and `docker-compose` commands. Often finding usage of `mail` instead of the expected `mailserver`
Additionally changes `mailserver` hostname in k8s to `mail` to align with other non-k8s examples.
---
* drive-by revisions
Mostly minor revisions or improvements to docs that aren't related to normalization effort.
2021-09-22 23:29:37 +00:00
- ./docker-data/dms/mail-data/:/var/mail/
- ./docker-data/dms/mail-state/:/var/mail-state/
- ./docker-data/dms/mail-logs/:/var/log/mail/
- ./docker-data/dms/config/:/tmp/docker-mailserver/
2021-06-21 15:36:59 +00:00
- /etc/localtime:/etc/localtime:ro
2016-12-25 21:54:37 +00:00
environment:
2019-05-05 18:22:51 +00:00
- ENABLE_SPAMASSASSIN=1
2020-05-02 17:10:36 +00:00
- SPAMASSASSIN_SPAM_TO_INBOX=1
2019-05-05 18:22:51 +00:00
- ENABLE_CLAMAV=1
- ENABLE_FAIL2BAN=1
- ENABLE_POSTGREY=1
2020-12-22 10:08:50 +00:00
- ENABLE_SASLAUTHD=0
2019-05-05 18:22:51 +00:00
- ONE_DIR=1
2016-12-25 21:54:37 +00:00
cap_add:
2019-05-05 18:22:51 +00:00
- NET_ADMIN
2020-09-21 11:54:31 +00:00
restart: always
2016-09-07 17:39:27 +00:00
```
2016-02-01 14:05:29 +00:00
2022-02-05 09:54:54 +00:00
### LDAP Setup
**Note** There are currently no LDAP maintainers. If you encounter issues, please raise them in the issue tracker, but be aware that the core maintainers team will most likely not be able to help you. **We would appreciate and we encourage everyone to actively participate in maintaining LDAP-related code by becoming a maintainer!**
2017-07-03 11:16:16 +00:00
2020-09-04 06:42:12 +00:00
``` YAML
2020-09-09 15:19:48 +00:00
version: '3.8'
2017-07-03 11:16:16 +00:00
services:
2021-02-01 17:39:05 +00:00
mailserver:
2021-01-16 09:16:05 +00:00
image: docker.io/mailserver/docker-mailserver:latest
docs(chore): Normalize for consistency (#2206)
"Brief" summary/overview of changes. See the PR discussion or individual commits from the PR for more details.
---
Only applies to the `docs/content/**` content (_and `setup` command_). `target/` and `test/` can be normalized at a later date.
* Normalize to `example.com`
- Domains normalized to `example.com`: `mywebserver.com`, `myserver.tld`, `domain.com`, `domain.tld`, `mydomain.net`, `my-domain.tld`, `my-domain.com`, `example.org`, `whoami.com`.
- Alternative domains normalized to `not-example.com`: `otherdomain.com`, `otherdomain.tld`, `domain2.tld`, `mybackupmx.com`, `whoareyou.org`.
- Email addresses normalized to `admin@example.com` (in `ssl.md`): `foo@bar.com`, `yourcurrentemail@gmail.com`, `email@email.com`, `admin@domain.tld`.
- Email addresses normalized to `external-account@gmail.com`: `bill@gates321boom.com`, `external@gmail.com`, `myemail@gmail.com`, `real-email-address@external-domain.com`.
- **`faq.md`:** A FAQ entry title with `sample.domain.com` changed to `subdomain.example.com`.
- **`mail-fetchmail.md`:** Config examples with FQDNs for `imap`/`pop3` used `example.com` domain for a third-party, changed to `gmail.com` as more familiar third-party/external MTA.
* Normalize config volume path
- Normalizing local config path references to `./docker-data/dms/config/`: `./config/`, `config/`, \``config`\`, `/etc/` (_volume mount src path prefix_).
- Normalize DMS volume paths to `docker-data/dms/mail-{data,state,log}`: `./mail`, `./mail-state` `./data/mail`, `./data/state`, `./data/logs`, `./data/maildata`, `./data/mailstate`, `./data/maillogs`, (_dropped/converted data volumes: `maildata`, `mailstate`_).
- Other docker images also adopt the `docker-data/{service name}/` prefix.
* `ssl.md` - Use `dms/custom-certs` where appropriate.
* Apply normalizations to README and example `docker-compose.yml`
---
Common terms, sometimes interchangeably used or now invalid depending on context: `mail`, `mail container`, `mail server`, `mail-server`, `mailserver`,`docker-mailserver`, `Docker Mailserver`.
Rough transformations applied to most matches (_conditionally, depending on context_):
- 'Docker Mailserver' => '`docker-mailserver`'
- 'mail container' => '`docker-mailserver`' (_optionally retaining ' container'_)
- 'mail server' => 'mail-server' / '`docker-mailserver`'
- 'mail-server' => '`docker-mailserver`'
- 'mailserver' => 'mail-server' / '`docker-mailserver`'
Additionally I checked `docker run` (_plus `exec`, `logs`, etc, sub-commands_) and `docker-compose` commands. Often finding usage of `mail` instead of the expected `mailserver`
Additionally changes `mailserver` hostname in k8s to `mail` to align with other non-k8s examples.
---
* drive-by revisions
Mostly minor revisions or improvements to docs that aren't related to normalization effort.
2021-09-22 23:29:37 +00:00
container_name: mailserver
2021-05-11 10:15:34 +00:00
hostname: mail
domainname: example.com
2017-07-03 11:16:16 +00:00
ports:
- "25:25"
- "143:143"
- "587:587"
- "993:993"
volumes:
docs(chore): Normalize for consistency (#2206)
"Brief" summary/overview of changes. See the PR discussion or individual commits from the PR for more details.
---
Only applies to the `docs/content/**` content (_and `setup` command_). `target/` and `test/` can be normalized at a later date.
* Normalize to `example.com`
- Domains normalized to `example.com`: `mywebserver.com`, `myserver.tld`, `domain.com`, `domain.tld`, `mydomain.net`, `my-domain.tld`, `my-domain.com`, `example.org`, `whoami.com`.
- Alternative domains normalized to `not-example.com`: `otherdomain.com`, `otherdomain.tld`, `domain2.tld`, `mybackupmx.com`, `whoareyou.org`.
- Email addresses normalized to `admin@example.com` (in `ssl.md`): `foo@bar.com`, `yourcurrentemail@gmail.com`, `email@email.com`, `admin@domain.tld`.
- Email addresses normalized to `external-account@gmail.com`: `bill@gates321boom.com`, `external@gmail.com`, `myemail@gmail.com`, `real-email-address@external-domain.com`.
- **`faq.md`:** A FAQ entry title with `sample.domain.com` changed to `subdomain.example.com`.
- **`mail-fetchmail.md`:** Config examples with FQDNs for `imap`/`pop3` used `example.com` domain for a third-party, changed to `gmail.com` as more familiar third-party/external MTA.
* Normalize config volume path
- Normalizing local config path references to `./docker-data/dms/config/`: `./config/`, `config/`, \``config`\`, `/etc/` (_volume mount src path prefix_).
- Normalize DMS volume paths to `docker-data/dms/mail-{data,state,log}`: `./mail`, `./mail-state` `./data/mail`, `./data/state`, `./data/logs`, `./data/maildata`, `./data/mailstate`, `./data/maillogs`, (_dropped/converted data volumes: `maildata`, `mailstate`_).
- Other docker images also adopt the `docker-data/{service name}/` prefix.
* `ssl.md` - Use `dms/custom-certs` where appropriate.
* Apply normalizations to README and example `docker-compose.yml`
---
Common terms, sometimes interchangeably used or now invalid depending on context: `mail`, `mail container`, `mail server`, `mail-server`, `mailserver`,`docker-mailserver`, `Docker Mailserver`.
Rough transformations applied to most matches (_conditionally, depending on context_):
- 'Docker Mailserver' => '`docker-mailserver`'
- 'mail container' => '`docker-mailserver`' (_optionally retaining ' container'_)
- 'mail server' => 'mail-server' / '`docker-mailserver`'
- 'mail-server' => '`docker-mailserver`'
- 'mailserver' => 'mail-server' / '`docker-mailserver`'
Additionally I checked `docker run` (_plus `exec`, `logs`, etc, sub-commands_) and `docker-compose` commands. Often finding usage of `mail` instead of the expected `mailserver`
Additionally changes `mailserver` hostname in k8s to `mail` to align with other non-k8s examples.
---
* drive-by revisions
Mostly minor revisions or improvements to docs that aren't related to normalization effort.
2021-09-22 23:29:37 +00:00
- ./docker-data/dms/mail-data/:/var/mail/
- ./docker-data/dms/mail-state/:/var/mail-state/
- ./docker-data/dms/mail-logs/:/var/log/mail/
- ./docker-data/dms/config/:/tmp/docker-mailserver/
2021-06-21 15:36:59 +00:00
- /etc/localtime:/etc/localtime:ro
2017-07-03 11:16:16 +00:00
environment:
- ENABLE_SPAMASSASSIN=1
2020-05-02 17:10:36 +00:00
- SPAMASSASSIN_SPAM_TO_INBOX=1
2017-07-03 11:16:16 +00:00
- ENABLE_CLAMAV=1
- ENABLE_FAIL2BAN=1
- ENABLE_POSTGREY=1
- ONE_DIR=1
2022-08-22 06:31:32 +00:00
- ENABLE_LDAP=1 # with the :edge tag, use ACCOUNT_PROVISIONER
- ACCOUNT_PROVISIONER=LDAP
2017-07-03 11:16:16 +00:00
- LDAP_SERVER_HOST=ldap # your ldap container/IP/ServerName
- LDAP_SEARCH_BASE=ou=people,dc=localhost,dc=localdomain
- LDAP_BIND_DN=cn=admin,dc=localhost,dc=localdomain
- LDAP_BIND_PW=admin
2018-11-03 20:52:17 +00:00
- LDAP_QUERY_FILTER_USER=(& (mail=%s)(mailEnabled=TRUE))
- LDAP_QUERY_FILTER_GROUP=(& (mailGroupMember=%s)(mailEnabled=TRUE))
2019-02-02 10:02:31 +00:00
- LDAP_QUERY_FILTER_ALIAS=(|(& (mailAlias=%s)(objectClass=PostfixBookMailForward))(& (mailAlias=%s)(objectClass=PostfixBookMailAccount)(mailEnabled=TRUE)))
- LDAP_QUERY_FILTER_DOMAIN=(|(& (mail=*@%s)(objectClass=PostfixBookMailAccount)(mailEnabled=TRUE))(& (mailGroupMember=*@%s)(objectClass=PostfixBookMailAccount)(mailEnabled=TRUE))(& (mailalias=*@%s)(objectClass=PostfixBookMailForward)))
2018-11-03 20:52:17 +00:00
- DOVECOT_PASS_FILTER=(& (objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))
- DOVECOT_USER_FILTER=(& (objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))
2017-07-03 11:16:16 +00:00
- ENABLE_SASLAUTHD=1
- SASLAUTHD_MECHANISMS=ldap
- SASLAUTHD_LDAP_SERVER=ldap
- SASLAUTHD_LDAP_BIND_DN=cn=admin,dc=localhost,dc=localdomain
- SASLAUTHD_LDAP_PASSWORD=admin
- SASLAUTHD_LDAP_SEARCH_BASE=ou=people,dc=localhost,dc=localdomain
2020-07-23 05:14:54 +00:00
- SASLAUTHD_LDAP_FILTER=(& (objectClass=PostfixBookMailAccount)(uniqueIdentifier=%U))
2017-07-03 11:16:16 +00:00
- POSTMASTER_ADDRESS=postmaster@localhost.localdomain
2018-10-15 19:17:45 +00:00
- POSTFIX_MESSAGE_SIZE_LIMIT=100000000
2017-07-03 11:16:16 +00:00
cap_add:
- NET_ADMIN
2020-09-21 11:54:31 +00:00
restart: always
2017-07-03 11:16:16 +00:00
```