<commit_before># hardware/mailserver

[![](https://badge.imagelayers.io/hardware/mailserver:latest.svg)](https://imagelayers.io/?images=hardware/mailserver:latest 'Get your own badge on imagelayers.io')

![Mailserver](https://i.imgur.com/7romRth.png "Mailserver")

### Requirement

- Docker 1.0 or higher
- MariaDB
- [Postfixadmin](https://github.com/hardware/postfixadmin) (optional)

### Components

- Postfix 2.11.3
- Dovecot 2.2.13
- OpenDKIM 2.9.2
- OpenDMARC 1.3.0
- Spamassassin 3.4.0
- ClamAV 0.98.7
- Amavisd-new 2.10.1
- Amavisd-milter 1.5.0
- Supervisor 3.0r1
- Rsyslog 8.4.2
- ManageSieve server

### Ports

- **25** : SMTP
- **143** : IMAP (STARTTLS)
- **465** : SMTP (SSL/TLS)
- **587** : SMTP (STARTTLS)
- **993** : IMAP (SSL/TLS)
- **4190** : SIEVE (STARTTLS)

### Install

```
docker pull hardware/mailserver
sudo groupadd -g 1024 vmail
sudo useradd -g vmail -u 1024 vmail -d /docker/mail
```

### How to use

```
docker run -d \
  --name mailserver \
  -p 25:25 -p 143:143 -p 465:465 -p 587:587 -p 993:993 -p 4190:4190 \
  -e DBHOST=mariadb \
  -e DBUSER=postfix \
  -e DBNAME=postfix \
  -e DBPASS=<PASSWORD> \
  -e ADD_DOMAINS=domain.tld,another-domain.tld \
  -v /docker/mail:/var/mail \
  -v /docker/dovecot:/var/lib/dovecot \
  -v /docker/opendkim:/etc/opendkim/keys \
  -h mail.domain.tld \
  --link mariadb:mariadb \
  hardware/mailserver
```

At first launch, the container takes few minutes to generate SSL certificates (if needed), Diffie-Hellman parameters, DKIM keypair and update clamav database, all of this takes some time, be patient...

You can check startup logs with this command :

```
docker logs -f mailserver
```

Once it's over (5/10 minutes approximately), you can check with `openssl s_client` :

#### SMTP - 25 port (MTA <-> MTA)
```
telnet mail.domain.tld 25
...
Connected to mail.domain.tld.
Escape character is '^]'.
220 mail.domain.tld ESMTP Postfix (Debian/GNU)<commit_msg>docs(): fix misleading information<commit_after># hardware/mailserver

[![](https://badge.imagelayers.io/hardware/mailserver:latest.svg)](https://imagelayers.io/?images=hardware/mailserver:latest 'Get your own badge on imagelayers.io')

![Mailserver](https://i.imgur.com/7romRth.png "Mailserver")

### Requirement

- Docker 1.0 or higher
- MariaDB
- [Postfixadmin](https://github.com/hardware/postfixadmin) (optional)

### Components

- Postfix 2.11.3
- Dovecot 2.2.13
- OpenDKIM 2.9.2
- OpenDMARC 1.3.0
- Spamassassin 3.4.0
- ClamAV 0.98.7
- Amavisd-new 2.10.1
- Amavisd-milter 1.5.0
- Supervisor 3.0r1
- Rsyslog 8.4.2
- ManageSieve server

### Ports

- **25** : SMTP
- **143** : IMAP (STARTTLS)
- **465** : SMTP (SSL/TLS)
- **587** : SMTP (STARTTLS)
- **993** : IMAP (SSL/TLS)
- **4190** : SIEVE (STARTTLS)

### Install

```
docker pull hardware/mailserver
sudo groupadd -g 1024 vmail
sudo useradd -g vmail -u 1024 vmail -d /docker/mail
```

### How to use

```
docker run -d \
  --name mailserver \
  -p 25:25 -p 143:143 -p 465:465 -p 587:587 -p 993:993 -p 4190:4190 \
  -e DBHOST=mariadb \
  -e DBUSER=postfix \
  -e DBNAME=postfix \
  -e DBPASS=<PASSWORD> \
  -e ADD_DOMAINS=domain2.tld,another-domain.tld \
  -v /docker/mail:/var/mail \
  -v /docker/dovecot:/var/lib/dovecot \
  -v /docker/opendkim:/etc/opendkim/keys \
  -h mail.domain.tld \
  --link mariadb:mariadb \
  hardware/mailserver
```

At first launch, the container takes few minutes to generate SSL certificates (if needed), Diffie-Hellman parameters, DKIM keypair and update clamav database, all of this takes some time, be patient...

You can check startup logs with this command :

```
docker logs -f mailserver
```

Once it's over (5/10 minutes approximately), you can check with `openssl s_client` :

#### SMTP - 25 port (MTA <-> MTA)
```
telnet mail.domain.tld 25
...
Connected to mail.domain.tld.
Escape character is '^]'.
220 mail.domain.tld ESMTP Postfix (Debian/GNU)
{'fraction_non_alphanumeric': 0.16003102378490175, 'fraction_numerical': 0.056618407445708376, 'mean_word_length': 3.3668171557562077, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6009005', 'n_tokens_mistral': 1715, 'n_tokens_neox': 1498, 'n_words': 386}