This commit is contained in:
github-actions[bot] 2021-09-22 23:30:04 +00:00
parent 07afd2c901
commit 4d20a99272
46 changed files with 847 additions and 862 deletions

View file

@ -6,7 +6,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="A fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.) using Docker.">
<meta name="description" content="A fullstack but simple mail-server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.) using Docker.">
@ -16,7 +16,7 @@
<link rel="canonical" href="https://docker-mailserver.github.io/docker-mailserver/edge/faq/">
<link rel="icon" href="../assets/logo/favicon-32x32.png">
<meta name="generator" content="mkdocs-1.2.2, mkdocs-material-7.2.6">
<meta name="generator" content="mkdocs-1.2.2, mkdocs-material-7.2.8">
@ -24,7 +24,7 @@
<link rel="stylesheet" href="../assets/stylesheets/main.802231af.min.css">
<link rel="stylesheet" href="../assets/stylesheets/main.92558b1b.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.3f5d1f46.min.css">
@ -1028,7 +1028,7 @@
<li class="md-nav__item">
<a href="../examples/tutorials/mailserver-behind-proxy/" class="md-nav__link">
Mailserver behind Proxy
Mail-Server behind a Proxy
</a>
</li>
@ -1079,7 +1079,7 @@
<li class="md-nav__item">
<a href="../examples/uses-cases/forward-only-mailserver-with-ldap-authentication/" class="md-nav__link">
Forward-Only Mailserver with LDAP
Forward-Only Mail-Server with LDAP
</a>
</li>
@ -1160,8 +1160,8 @@
</li>
<li class="md-nav__item">
<a href="#how-to-alter-the-running-mailserver-instance-without-relaunching-the-container" class="md-nav__link">
How to alter the running mailserver instance without relaunching the container?
<a href="#how-to-alter-the-running-docker-mailserver-instance-without-relaunching-the-container" class="md-nav__link">
How to alter the running docker-mailserver instance without relaunching the container?
</a>
</li>
@ -1208,8 +1208,8 @@
</li>
<li class="md-nav__item">
<a href="#what-is-the-mail-state-folder-for" class="md-nav__link">
What is the mail-state folder for?
<a href="#what-about-docker-datadmsmail-state-folder-varmail-state-internally" class="md-nav__link">
What about docker-data/dms/mail-state folder? (/var/mail-state internally)
</a>
</li>
@ -1243,8 +1243,8 @@
</li>
<li class="md-nav__item">
<a href="#why-are-spamassassin-x-headers-not-inserted-into-my-sampledomaincom-subdomain-emails" class="md-nav__link">
Why are SpamAssassin x-headers not inserted into my sample.domain.com subdomain emails?
<a href="#why-are-spamassassin-x-headers-not-inserted-into-my-subdomainexamplecom-subdomain-emails" class="md-nav__link">
Why are SpamAssassin x-headers not inserted into my subdomain.example.com subdomain emails?
</a>
</li>
@ -1286,7 +1286,7 @@
<li class="md-nav__item">
<a href="#i-just-moved-from-my-old-mail-server-but-it-doesnt-work" class="md-nav__link">
I just moved from my old mail server, but "it doesn't work"?
I just moved from my old Mail-Server, but "it doesn't work"?
</a>
</li>
@ -1507,8 +1507,8 @@
</li>
<li class="md-nav__item">
<a href="#how-to-alter-the-running-mailserver-instance-without-relaunching-the-container" class="md-nav__link">
How to alter the running mailserver instance without relaunching the container?
<a href="#how-to-alter-the-running-docker-mailserver-instance-without-relaunching-the-container" class="md-nav__link">
How to alter the running docker-mailserver instance without relaunching the container?
</a>
</li>
@ -1555,8 +1555,8 @@
</li>
<li class="md-nav__item">
<a href="#what-is-the-mail-state-folder-for" class="md-nav__link">
What is the mail-state folder for?
<a href="#what-about-docker-datadmsmail-state-folder-varmail-state-internally" class="md-nav__link">
What about docker-data/dms/mail-state folder? (/var/mail-state internally)
</a>
</li>
@ -1590,8 +1590,8 @@
</li>
<li class="md-nav__item">
<a href="#why-are-spamassassin-x-headers-not-inserted-into-my-sampledomaincom-subdomain-emails" class="md-nav__link">
Why are SpamAssassin x-headers not inserted into my sample.domain.com subdomain emails?
<a href="#why-are-spamassassin-x-headers-not-inserted-into-my-subdomainexamplecom-subdomain-emails" class="md-nav__link">
Why are SpamAssassin x-headers not inserted into my subdomain.example.com subdomain emails?
</a>
</li>
@ -1633,7 +1633,7 @@
<li class="md-nav__item">
<a href="#i-just-moved-from-my-old-mail-server-but-it-doesnt-work" class="md-nav__link">
I just moved from my old mail server, but "it doesn't work"?
I just moved from my old Mail-Server, but "it doesn't work"?
</a>
</li>
@ -1728,9 +1728,9 @@ This image is based on config files that can be persisted using Docker volumes,
<p class="admonition-title">Warning</p>
<p>You should use a <a href="https://medium.com/@ramangupta/why-docker-data-containers-are-good-589b3c6c749e#.uxyrp7xpu">data volume container</a> for <code>/var/mail</code> to persist data. Otherwise, your data may be lost.</p>
</div>
<h3 id="how-to-alter-the-running-mailserver-instance-without-relaunching-the-container"><a class="toclink" href="#how-to-alter-the-running-mailserver-instance-without-relaunching-the-container">How to alter the running mailserver instance <em>without</em> relaunching the container?</a></h3>
<p><code>docker-mailserver</code> aggregates multiple "sub-services", such as Postfix, Dovecot, Fail2ban, SpamAssassin, etc. In many cases, one may edit a sub-service's config and reload that very sub-service, without stopping and relaunching the whole mail server.</p>
<p>In order to do so, you'll probably want to push your config updates to your server through a Docker volume, then restart the sub-service to apply your changes, using <code>supervisorctl</code>. For instance, after editing fail2ban's config: <code>supervisorctl restart fail2ban</code>.</p>
<h3 id="how-to-alter-the-running-docker-mailserver-instance-without-relaunching-the-container"><a class="toclink" href="#how-to-alter-the-running-docker-mailserver-instance-without-relaunching-the-container">How to alter the running <code>docker-mailserver</code> instance <em>without</em> relaunching the container?</a></h3>
<p><code>docker-mailserver</code> aggregates multiple "sub-services", such as Postfix, Dovecot, Fail2ban, SpamAssassin, etc. In many cases, one may edit a sub-service's config and reload that very sub-service, without stopping and relaunching the whole mail-server.</p>
<p>In order to do so, you'll probably want to push your config updates to your server through a Docker volume (these docs use: <code>./docker-data/dms/config/:/tmp/docker-mailserver/</code>), then restart the sub-service to apply your changes, using <code>supervisorctl</code>. For instance, after editing fail2ban's config: <code>supervisorctl restart fail2ban</code>.</p>
<p>See <a href="http://supervisord.org/running.html#running-supervisorctl">supervisorctl's documentation</a>.</p>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
@ -1754,46 +1754,46 @@ This image is based on config files that can be persisted using Docker volumes,
<p>Please do not use <code>CRLF</code>.</p>
<h3 id="what-about-backups"><a class="toclink" href="#what-about-backups">What about backups?</a></h3>
<h4 id="bind-mounts-default"><a class="toclink" href="#bind-mounts-default">Bind mounts (default)</a></h4>
<p>From the location of your <code>docker-compose.yml</code>, create a compressed archive of your <code>./config</code> and <code>./data</code> folders:</p>
<div class="highlight"><pre><span></span><code>tar --gzip -cf <span class="s2">&quot;backup-</span><span class="k">$(</span>date +%F<span class="k">)</span><span class="s2">.tar.gz&quot;</span> config data
<p>From the location of your <code>docker-compose.yml</code>, create a compressed archive of your <code>docker-data/dms/config/</code> and <code>docker-data/dms/mail-*</code> folders:</p>
<div class="highlight"><pre><span></span><code>tar --gzip -cf <span class="s2">&quot;backup-</span><span class="k">$(</span>date +%F<span class="k">)</span><span class="s2">.tar.gz&quot;</span> ./docker-data/dms
</code></pre></div>
<p>Then to restore <code>./config</code> and <code>./data</code> folders from your backup file:</p>
<p>Then to restore <code>docker-data/dms/config/</code> and <code>docker-data/dms/mail-*</code> folders from your backup file:</p>
<div class="highlight"><pre><span></span><code>tar --gzip -xf backup-date.tar.gz
</code></pre></div>
<h4 id="volumes"><a class="toclink" href="#volumes">Volumes</a></h4>
<p>Assuming that you use <code>docker-compose</code> and data volumes, you can backup the configuration, emails and logs like this:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># create backup</span>
docker run --rm -it <span class="se">\</span>
-v <span class="s2">&quot;</span><span class="nv">$PWD</span><span class="s2">/config&quot;</span>:/tmp/docker-mailserver <span class="se">\</span>
-v /backup/mail:/backup <span class="se">\</span>
-v <span class="s2">&quot;</span><span class="si">${</span><span class="nv">PWD</span><span class="si">}</span><span class="s2">/docker-data/dms/config/:/tmp/docker-mailserver/&quot;</span> <span class="se">\</span>
-v <span class="s2">&quot;</span><span class="si">${</span><span class="nv">PWD</span><span class="si">}</span><span class="s2">/docker-data/dms-backups/:/backup/&quot;</span> <span class="se">\</span>
--volumes-from mailserver <span class="se">\</span>
alpine:latest <span class="se">\</span>
tar czf <span class="s2">&quot;/backup/mail-</span><span class="k">$(</span>date +%F<span class="k">)</span><span class="s2">.tar.gz&quot;</span> /var/mail /var/mail-state /var/logs/mail /tmp/docker-mailserver
<span class="c1"># delete backups older than 30 days</span>
find /backup/mail -type f -mtime +30 -delete
find <span class="s2">&quot;</span><span class="si">${</span><span class="nv">PWD</span><span class="si">}</span><span class="s2">/docker-data/dms-backups/&quot;</span> -type f -mtime +30 -delete
</code></pre></div>
<h3 id="what-is-the-mail-state-folder-for"><a class="toclink" href="#what-is-the-mail-state-folder-for">What is the <code>mail-state</code> folder for?</a></h3>
<h3 id="what-about-docker-datadmsmail-state-folder-varmail-state-internally"><a class="toclink" href="#what-about-docker-datadmsmail-state-folder-varmail-state-internally">What about <code>docker-data/dms/mail-state</code> folder? (<em><code>/var/mail-state</code> internally</em>)</a></h3>
<p>When you run <code>docker-mailserver</code> with the ENV var <code>ONE_DIR=1</code> (<em>default since v10.2</em>), this folder will store the data from internal services so that you can more easily persist state to disk (via <code>volumes</code>).</p>
<p>This has the advantage of fail2ban blocks, ClamAV anti-virus updates and the like being kept across restarts for example.</p>
<p>Service data is <a href="https://github.com/docker-mailserver/docker-mailserver/blob/c7e498194546416fb7231cb03254e77e085d18df/target/scripts/startup/misc-stack.sh#L24-L33">relocated to the <code>mail-state</code> folder</a> for services: Postfix, Dovecot, Fail2Ban, Amavis, PostGrey, ClamAV, SpamAssassin.</p>
<h3 id="how-can-i-configure-my-email-client"><a class="toclink" href="#how-can-i-configure-my-email-client">How can I configure my email client?</a></h3>
<p>Login are full email address (<code>user@domain.com</code>).</p>
<p>Login is full email address (<code>&lt;user&gt;@&lt;domain&gt;</code>).</p>
<div class="highlight"><pre><span></span><code><span class="c"># imap</span>
<span class="na">username</span><span class="o">:</span> <span class="s">&lt;user1@domain.tld&gt;</span>
<span class="na">username</span><span class="o">:</span> <span class="s">&lt;user1@example.com&gt;</span>
<span class="na">password</span><span class="o">:</span> <span class="s">&lt;mypassword&gt;</span>
<span class="na">server</span><span class="o">:</span> <span class="s">&lt;mail.domain.tld&gt;</span>
<span class="na">server</span><span class="o">:</span> <span class="s">&lt;mail.example.com&gt;</span>
<span class="na">imap port</span><span class="o">:</span> <span class="s">143 or 993 with ssl (recommended)</span>
<span class="na">imap path prefix</span><span class="o">:</span> <span class="s">INBOX</span>
<span class="c"># smtp</span>
<span class="na">smtp port</span><span class="o">:</span> <span class="s">25 or 587 with ssl (recommended)</span>
<span class="na">username</span><span class="o">:</span> <span class="s">&lt;user1@domain.tld&gt;</span>
<span class="na">username</span><span class="o">:</span> <span class="s">&lt;user1@example.com&gt;</span>
<span class="na">password</span><span class="o">:</span> <span class="s">&lt;mypassword&gt;</span>
</code></pre></div>
<p>Please use <code>STARTTLS</code>.</p>
<h3 id="how-can-i-manage-my-custom-spamassassin-rules"><a class="toclink" href="#how-can-i-manage-my-custom-spamassassin-rules">How can I manage my custom SpamAssassin rules?</a></h3>
<p>Antispam rules are managed in <code>config/spamassassin-rules.cf</code>.</p>
<p>Antispam rules are managed in <code>docker-data/dms/config/spamassassin-rules.cf</code>.</p>
<h3 id="what-are-acceptable-sa_spam_subject-values"><a class="toclink" href="#what-are-acceptable-sa_spam_subject-values">What are acceptable <code>SA_SPAM_SUBJECT</code> values?</a></h3>
<p>For no subject set <code>SA_SPAM_SUBJECT=undef</code>.</p>
<p>For a trailing white-space subject one can define the whole variable with quotes in <code>docker-compose.yml</code>:</p>
@ -1802,16 +1802,16 @@ find /backup/mail -type f -mtime +30 -delete
</code></pre></div>
<h3 id="can-i-use-nakedbare-domains-no-host-name"><a class="toclink" href="#can-i-use-nakedbare-domains-no-host-name">Can I use naked/bare domains (no host name)?</a></h3>
<p>Yes, but not without some configuration changes. Normally it is assumed that <code>docker-mailserver</code> runs on a host with a name, so the fully qualified host name might be <code>mail.example.com</code> with the domain <code>example.com</code>. The MX records point to <code>mail.example.com</code>.</p>
<p>To use a bare domain where the host name is <code>example.com</code> and the domain is also <code>example.com</code>, change <code>mydestination</code>:</p>
<p>To use a bare domain (<em>where the host name is <code>example.com</code> and the domain is also <code>example.com</code></em>), change <code>mydestination</code>:</p>
<ul>
<li>From: <code>mydestination = $myhostname, localhost.$mydomain, localhost</code></li>
<li>To: <code>mydestination = localhost.$mydomain, localhost</code></li>
</ul>
<p>Add the latter line to <code>config/postfix-main.cf</code>. That should work. Without that change there will be warnings in the logs like:</p>
<p>Add the latter line to <code>docker-data/dms/config/postfix-main.cf</code>. That should work. Without that change there will be warnings in the logs like:</p>
<div class="highlight"><pre><span></span><code><span class="go">warning: do not list domain example.com in BOTH mydestination and virtual_mailbox_domains</span>
</code></pre></div>
<p>Plus of course mail delivery fails.</p>
<h3 id="why-are-spamassassin-x-headers-not-inserted-into-my-sampledomaincom-subdomain-emails"><a class="toclink" href="#why-are-spamassassin-x-headers-not-inserted-into-my-sampledomaincom-subdomain-emails">Why are SpamAssassin <code>x-headers</code> not inserted into my <code>sample.domain.com</code> subdomain emails?</a></h3>
<h3 id="why-are-spamassassin-x-headers-not-inserted-into-my-subdomainexamplecom-subdomain-emails"><a class="toclink" href="#why-are-spamassassin-x-headers-not-inserted-into-my-subdomainexamplecom-subdomain-emails">Why are SpamAssassin <code>x-headers</code> not inserted into my <code>subdomain.example.com</code> subdomain emails?</a></h3>
<p>In the default setup, amavis only applies SpamAssassin x-headers into domains matching the template listed in the config file (<code>05-domain_id</code> in the amavis defaults).</p>
<p>The default setup <code>@local_domains_acl = ( ".$mydomain" );</code> does not match subdomains. To match subdomains, you can override the <code>@local_domains_acl</code> directive in the amavis user config file <code>50-user</code> with <code>@local_domains_maps = (".");</code> to match any sort of domain template.</p>
<h3 id="how-can-i-make-spamassassin-better-recognize-spam"><a class="toclink" href="#how-can-i-make-spamassassin-better-recognize-spam">How can I make SpamAssassin better recognize spam?</a></h3>
@ -1821,18 +1821,18 @@ find /backup/mail -type f -mtime +30 -delete
<span class="c1">#</span>
<span class="c1"># m h dom mon dow command</span>
<span class="c1"># Everyday 2:00AM, learn spam from a specific user</span>
<span class="na">0 2 * * * docker exec mail sa-learn --spam /var/mail/domain.com/username/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="na">0 2 * * * docker exec mailserver sa-learn --spam /var/mail/example.com/username/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
</code></pre></div>
<p>If you run the server with <code>docker-compose</code>, you can leverage on docker configs and the mailserver's own cron. This is less problematic than the simple solution shown above, because it decouples the learning from the host on which the mailserver is running and avoids errors if the server is not running.</p>
<p>With <code>docker-compose</code> you can more easily use the internal instance of <code>cron</code> within <code>docker-mailserver</code>. This is less problematic than the simple solution shown above, because it decouples the learning from the host on which <code>docker-mailserver</code> is running, and avoids errors if the mail-server is not running.</p>
<p>The following configuration works nicely:</p>
<details class="example"><summary>Example</summary><p>Create a <em>system</em> cron file:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># in the docker-compose.yml root directory</span>
mkdir cron
touch cron/sa-learn
chown root:root cron/sa-learn
chmod <span class="m">0644</span> cron/sa-learn
mkdir -p ./docker-data/dms/cron
touch ./docker-data/dms/cron/sa-learn
chown root:root ./docker-data/dms/cron/sa-learn
chmod <span class="m">0644</span> ./docker-data/dms/cron/sa-learn
</code></pre></div>
<p>Edit the system cron file <code>nano cron/sa-learn</code>, and set an appropriate configuration:</p>
<p>Edit the system cron file <code>nano ./docker-data/dms/cron/sa-learn</code>, and set an appropriate configuration:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># This assumes you&#39;re having `environment: ONE_DIR=1` in the env-mailserver,</span>
<span class="c1"># with a consolidated config in `/var/mail-state`</span>
<span class="c1">#</span>
@ -1840,29 +1840,29 @@ chmod <span class="m">0644</span> cron/sa-learn
<span class="c1">#</span>
<span class="c1"># Everyday 2:00AM, learn spam from a specific user</span>
<span class="c1"># spam: junk directory</span>
<span class="na">0 2 * * * root sa-learn --spam /var/mail/domain.com/username/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="na">0 2 * * * root sa-learn --spam /var/mail/example.com/username/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="c1"># ham: archive directories</span>
<span class="na">15 2 * * * root sa-learn --ham /var/mail/domain.com/username/.Archive* --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="na">15 2 * * * root sa-learn --ham /var/mail/example.com/username/.Archive* --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="c1"># ham: inbox subdirectories</span>
<span class="na">30 2 * * * root sa-learn --ham /var/mail/domain.com/username/cur* --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="na">30 2 * * * root sa-learn --ham /var/mail/example.com/username/cur* --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="c1">#</span>
<span class="c1"># Everyday 3:00AM, learn spam from all users of a domain</span>
<span class="c1"># spam: junk directory</span>
<span class="na">0 3 * * * root sa-learn --spam /var/mail/otherdomain.com/*/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="na">0 3 * * * root sa-learn --spam /var/mail/not-example.com/*/.Junk --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="c1"># ham: archive directories</span>
<span class="na">15 3 * * * root sa-learn --ham /var/mail/otherdomain.com/*/.Archive* --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="na">15 3 * * * root sa-learn --ham /var/mail/not-example.com/*/.Archive* --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="c1"># ham: inbox subdirectories</span>
<span class="na">30 3 * * * root sa-learn --ham /var/mail/otherdomain.com/*/cur* --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
<span class="na">30 3 * * * root sa-learn --ham /var/mail/not-example.com/*/cur* --dbpath /var/mail-state/lib-amavis/.spamassassin</span>
</code></pre></div>
<p>Then with plain <code>docker-compose</code>:</p>
<p>Then with <code>docker-compose.yml</code>:</p>
<div class="highlight"><pre><span></span><code><span class="nt">services</span><span class="p">:</span>
<span class="nt">mailserver</span><span class="p">:</span>
<span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">docker.io/mailserver/docker-mailserver:latest</span>
<span class="nt">volumes</span><span class="p">:</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">./cron/sa-learn:/etc/cron.d/sa-learn</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">./docker-data/dms/cron/sa-learn:/etc/cron.d/sa-learn</span>
</code></pre></div>
<p>Or with <a href="https://docs.docker.com/engine/swarm/configs/">docker swarm</a>:</p>
<div class="highlight"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&quot;3.3&quot;</span>
<p>Or with <a href="https://docs.docker.com/engine/swarm/configs/">Docker Swarm</a>:</p>
<div class="highlight"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&#39;3.8&#39;</span>
<span class="nt">services</span><span class="p">:</span>
<span class="nt">mailserver</span><span class="p">:</span>
@ -1874,20 +1874,20 @@ chmod <span class="m">0644</span> cron/sa-learn
<span class="nt">configs</span><span class="p">:</span>
<span class="nt">my_sa_crontab</span><span class="p">:</span>
<span class="nt">file</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">./cron/sa-learn</span>
<span class="nt">file</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">./docker-data/dms/cron/sa-learn</span>
</code></pre></div>
</details>
<p>With the default settings, SpamAssassin will require 200 mails trained for spam (for example with the method explained above) and 200 mails trained for ham (using the same command as above but using <code>--ham</code> and providing it with some ham mails). Until you provided these 200+200 mails, SpamAssassin will not take the learned mails into account. For further reference, see the <a href="https://wiki.apache.org/spamassassin/BayesNotWorking">SpamAssassin Wiki</a>.</p>
<h3 id="how-can-i-configure-a-catch-all"><a class="toclink" href="#how-can-i-configure-a-catch-all">How can I configure a catch-all?</a></h3>
<p>Considering you want to redirect all incoming e-mails for the domain <code>domain.tld</code> to <code>user1@domain.tld</code>, add the following line to <code>config/postfix-virtual.cf</code>:</p>
<div class="highlight"><pre><span></span><code><span class="na">@domain.tld user1@domain.tld</span>
<p>Considering you want to redirect all incoming e-mails for the domain <code>example.com</code> to <code>user1@example.com</code>, add the following line to <code>docker-data/dms/config/postfix-virtual.cf</code>:</p>
<div class="highlight"><pre><span></span><code><span class="na">@example.com user1@example.com</span>
</code></pre></div>
<h3 id="how-can-i-delete-all-the-emails-for-a-specific-user"><a class="toclink" href="#how-can-i-delete-all-the-emails-for-a-specific-user">How can I delete all the emails for a specific user?</a></h3>
<p>First of all, create a special alias named <code>devnull</code> by editing <code>config/postfix-aliases.cf</code>:</p>
<p>First of all, create a special alias named <code>devnull</code> by editing <code>docker-data/dms/config/postfix-aliases.cf</code>:</p>
<div class="highlight"><pre><span></span><code><span class="na">devnull: /dev/null</span>
</code></pre></div>
<p>Considering you want to delete all the e-mails received for <code>baduser@domain.tld</code>, add the following line to <code>config/postfix-virtual.cf</code>:</p>
<div class="highlight"><pre><span></span><code><span class="na">baduser@domain.tld devnull</span>
<p>Considering you want to delete all the e-mails received for <code>baduser@example.com</code>, add the following line to <code>docker-data/dms/config/postfix-virtual.cf</code>:</p>
<div class="highlight"><pre><span></span><code><span class="na">baduser@example.com devnull</span>
</code></pre></div>
<h3 id="how-do-i-have-more-control-about-what-spamassasin-is-filtering"><a class="toclink" href="#how-do-i-have-more-control-about-what-spamassasin-is-filtering">How do I have more control about what SPAMASSASIN is filtering?</a></h3>
<p>By default, SPAM and INFECTED emails are put to a quarantine which is not very straight forward to access. Several config settings are affecting this behavior:</p>
@ -1915,20 +1915,20 @@ chmod <span class="m">0644</span> cron/sa-learn
<span class="nb">fileinto</span> <span class="s">&quot;Junk&quot;</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<p>Create a dedicated mailbox for emails which are infected/bad header and everything amavis is blocking by default and put its address into <code>config/amavis.cf</code></p>
<div class="highlight"><pre><span></span><code><span class="na">$clean_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@domain.com&quot;;</span>
<span class="na">$virus_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@domain.com&quot;;</span>
<span class="na">$banned_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@domain.com&quot;;</span>
<span class="na">$bad_header_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@domain.com&quot;;</span>
<span class="na">$spam_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@domain.com&quot;;</span>
<p>Create a dedicated mailbox for emails which are infected/bad header and everything amavis is blocking by default and put its address into <code>docker-data/dms/config/amavis.cf</code></p>
<div class="highlight"><pre><span></span><code><span class="na">$clean_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@example.com&quot;;</span>
<span class="na">$virus_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@example.com&quot;;</span>
<span class="na">$banned_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@example.com&quot;;</span>
<span class="na">$bad_header_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@example.com&quot;;</span>
<span class="na">$spam_quarantine_to</span> <span class="o">=</span> <span class="s">&quot;amavis\@example.com&quot;;</span>
</code></pre></div>
<h3 id="what-kind-of-ssl-certificates-can-i-use"><a class="toclink" href="#what-kind-of-ssl-certificates-can-i-use">What kind of SSL certificates can I use?</a></h3>
<p>You can use the same certificates you use with another mail server.</p>
<p>The only thing is that we provide a <code>self-signed</code> certificate tool and a <code>letsencrypt</code> certificate loader.</p>
<h3 id="i-just-moved-from-my-old-mail-server-but-it-doesnt-work"><a class="toclink" href="#i-just-moved-from-my-old-mail-server-but-it-doesnt-work">I just moved from my old mail server, but "it doesn't work"?</a></h3>
<p>You can use the same certificates you would use with another mail-server.</p>
<p>The only difference is that we provide a <code>self-signed</code> certificate tool and a <code>letsencrypt</code> certificate loader.</p>
<h3 id="i-just-moved-from-my-old-mail-server-but-it-doesnt-work"><a class="toclink" href="#i-just-moved-from-my-old-mail-server-but-it-doesnt-work">I just moved from my old Mail-Server, but "it doesn't work"?</a></h3>
<p>If this migration implies a DNS modification, be sure to wait for DNS propagation before opening an issue.
Few examples of symptoms can be found <a href="https://github.com/docker-mailserver/docker-mailserver/issues/95">here</a> or <a href="https://github.com/docker-mailserver/docker-mailserver/issues/97">here</a>.</p>
<p>This could be related to a modification of your <code>MX</code> record, or the IP mapped to <code>mail.my-domain.tld</code>. Additionally, <a href="https://intodns.com/">validate your DNS configuration</a>.</p>
<p>This could be related to a modification of your <code>MX</code> record, or the IP mapped to <code>mail.example.com</code>. Additionally, <a href="https://intodns.com/">validate your DNS configuration</a>.</p>
<p>If everything is OK regarding DNS, please provide <a href="https://guides.github.com/features/mastering-markdown/">formatted logs</a> and config files. This will allow us to help you.</p>
<p>If we're blind, we won't be able to do anything.</p>
<h3 id="what-system-requirements-are-required-to-run-docker-mailserver-effectively"><a class="toclink" href="#what-system-requirements-are-required-to-run-docker-mailserver-effectively">What system requirements are required to run <code>docker-mailserver</code> effectively?</a></h3>
@ -1968,18 +1968,18 @@ Otherwise, it could work with 512M of RAM.</p>
<span class="gp"># </span><span class="o">=</span>&gt; check requirements and/or start Clamav
</code></pre></div>
<h3 id="how-to-use-when-behind-a-proxy"><a class="toclink" href="#how-to-use-when-behind-a-proxy">How to use when behind a Proxy</a></h3>
<p>Add to <code>/etc/postfix/main.cf</code> :</p>
<p><a href="../config/advanced/override-defaults/user-patches/">Using <code>user-patches.sh</code></a>, update the container file <code>/etc/postfix/main.cf</code> to include:</p>
<div class="highlight"><pre><span></span><code><span class="na">proxy_interfaces</span> <span class="o">=</span> <span class="s">X.X.X.X (your public IP)</span>
</code></pre></div>
<h3 id="what-about-updates"><a class="toclink" href="#what-about-updates">What About Updates</a></h3>
<p>You can of course use a own script or every now and then pull &amp;&amp; stop &amp;&amp; rm &amp;&amp; start the images but there are tools available for this.
There is a section in the <a href="../config/advanced/maintenance/update-and-cleanup/">Update and Cleanup</a> documentation page that explains how to use it the docker way.</p>
<p>You can use your own scripts, or every now and then <code>pull &amp;&amp; stop &amp;&amp; rm &amp;&amp; start</code> the images but there are tools already available for this.</p>
<p>There is a section in the <a href="../config/advanced/maintenance/update-and-cleanup/">Update and Cleanup</a> documentation page that explains how to do it the docker way.</p>
<h3 id="how-to-adjust-settings-with-the-user-patchessh-script"><a class="toclink" href="#how-to-adjust-settings-with-the-user-patchessh-script">How to adjust settings with the <code>user-patches.sh</code> script</a></h3>
<p>Suppose you want to change a number of settings that are not listed as variables or add things to the server that are not included?</p>
<p>This docker-container has a built-in way to do post-install processes. If you place a script called <strong>user-patches.sh</strong> in the config directory it will be run after all configuration files are set up, but before the postfix, amavis and other daemons are started.</p>
<p>The config file I am talking about is this volume in the yml file: <code>./config/:/tmp/docker-mailserver/</code></p>
<p>To place such a script you can just make it in the config dir, for instance like this:</p>
<div class="highlight"><pre><span></span><code><span class="nb">cd</span> ./config
<p><code>docker-mailserver</code> has a built-in way to do post-install processes. If you place a script called <strong><code>user-patches.sh</code></strong> in the config directory it will be run after all configuration files are set up, but before the postfix, amavis and other daemons are started.</p>
<p>It is common to use a local directory for config added to <code>docker-mailsever</code> via a volume mount in your <code>docker-compose.yml</code> (eg: <code>./docker-data/dms/config/:/tmp/docker-mailserver/</code>).</p>
<p>Add or create the script file to your config directory:</p>
<div class="highlight"><pre><span></span><code><span class="nb">cd</span> ./docker-data/dms/config
touch user-patches.sh
chmod +x user-patches.sh
</code></pre></div>
@ -1997,9 +1997,10 @@ cat /tmp/docker-mailserver/user-patches.sh
<span class="c1"># exit the container shell back to the host shell</span>
<span class="nb">exit</span>
</code></pre></div>
<p>You can do a lot of things with such a script. You can find an example <code>user-patches.sh</code> script here: <a href="https://github.com/hanscees/dockerscripts/blob/master/scripts/tomav-user-patches.sh">example <code>user-patches.sh</code> script</a></p>
<p>You can do a lot of things with such a script. You can find an example <code>user-patches.sh</code> script here: <a href="https://github.com/hanscees/dockerscripts/blob/master/scripts/tomav-user-patches.sh">example <code>user-patches.sh</code> script</a>.</p>
<p>We also have a <a href="../config/advanced/override-defaults/user-patches/">very similar docs page</a> specifically about this feature!</p>
<h4 id="special-use-case-patching-the-supervisord-config"><a class="toclink" href="#special-use-case-patching-the-supervisord-config">Special use-case - Patching the <code>supervisord</code> config</a></h4>
<p>It seems worth noting, that the <code>user-patches.sh</code> gets executed trough supervisord. If you need to patch some supervisord config (e.g. <code>/etc/supervisor/conf.d/saslauth.conf</code>), the patching happens too late.</p>
<p>It seems worth noting, that the <code>user-patches.sh</code> gets executed through <code>supervisord</code>. If you need to patch some supervisord config (e.g. <code>/etc/supervisor/conf.d/saslauth.conf</code>), the patching happens too late.</p>
<p>An easy workaround is to make the <code>user-patches.sh</code> reload the supervisord config after patching it:</p>
<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/bash</span>
sed -i <span class="s1">&#39;s/rimap -r/rimap/&#39;</span> /etc/supervisor/conf.d/saslauth.conf
@ -2086,10 +2087,10 @@ supervisorctl update
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": ["navigation.tabs", "navigation.top", "navigation.expand", "navigation.instant"], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "search": "../assets/javascripts/workers/search.409db549.min.js", "version": {"provider": "mike"}}</script>
<script id="__config" type="application/json">{"base": "..", "features": ["navigation.tabs", "navigation.top", "navigation.expand", "navigation.instant"], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "search": "../assets/javascripts/workers/search.94ec81fe.min.js", "version": {"provider": "mike"}}</script>
<script src="../assets/javascripts/bundle.756773cc.min.js"></script>
<script src="../assets/javascripts/bundle.48dfec6c.min.js"></script>
</body>