mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-04 18:15:29 +02:00
deploy: 0698ad9370
This commit is contained in:
parent
f811be1c2c
commit
fbc68b5962
53 changed files with 15755 additions and 4627 deletions
|
@ -15,7 +15,7 @@
|
|||
<link rel="canonical" href="https://docker-mailserver.github.io/docker-mailserver/edge/config/advanced/mail-sieve/">
|
||||
|
||||
|
||||
<link rel="prev" href="../auth-oauth2/">
|
||||
<link rel="prev" href="../override-defaults/user-patches/">
|
||||
|
||||
|
||||
<link rel="next" href="../mail-fetchmail/">
|
||||
|
@ -560,12 +560,52 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item md-nav__item--nested">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<input class="md-nav__toggle md-toggle md-toggle--indeterminate" type="checkbox" id="__nav_4_2" >
|
||||
|
||||
|
||||
<label class="md-nav__link" for="__nav_4_2" id="__nav_4_2_label" tabindex="0">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Account Management
|
||||
</span>
|
||||
|
||||
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
</label>
|
||||
|
||||
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_4_2_label" aria-expanded="false">
|
||||
<label class="md-nav__title" for="__nav_4_2">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Account Management
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../user-management/" class="md-nav__link">
|
||||
<a href="../../account-management/overview/" class="md-nav__link">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
User Management
|
||||
Overview
|
||||
</span>
|
||||
|
||||
|
||||
|
@ -588,6 +628,194 @@
|
|||
|
||||
|
||||
|
||||
<li class="md-nav__item md-nav__item--nested">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<input class="md-nav__toggle md-toggle md-toggle--indeterminate" type="checkbox" id="__nav_4_2_2" >
|
||||
|
||||
|
||||
<label class="md-nav__link" for="__nav_4_2_2" id="__nav_4_2_2_label" tabindex="0">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Provisioner
|
||||
</span>
|
||||
|
||||
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
</label>
|
||||
|
||||
<nav class="md-nav" data-md-level="3" aria-labelledby="__nav_4_2_2_label" aria-expanded="false">
|
||||
<label class="md-nav__title" for="__nav_4_2_2">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Provisioner
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../account-management/provisioner/file/" class="md-nav__link">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
File Based
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../account-management/provisioner/ldap/" class="md-nav__link">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
LDAP Service
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item md-nav__item--nested">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<input class="md-nav__toggle md-toggle md-toggle--indeterminate" type="checkbox" id="__nav_4_2_3" >
|
||||
|
||||
|
||||
<label class="md-nav__link" for="__nav_4_2_3" id="__nav_4_2_3_label" tabindex="0">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Supplementary
|
||||
</span>
|
||||
|
||||
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
</label>
|
||||
|
||||
<nav class="md-nav" data-md-level="3" aria-labelledby="__nav_4_2_3_label" aria-expanded="false">
|
||||
<label class="md-nav__title" for="__nav_4_2_3">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Supplementary
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../account-management/supplementary/master-accounts/" class="md-nav__link">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Master Accounts
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../account-management/supplementary/oauth2/" class="md-nav__link">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
OAuth2 Authentication
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item md-nav__item--nested">
|
||||
|
||||
|
||||
|
@ -1147,48 +1375,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../auth-ldap/" class="md-nav__link">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
LDAP Authentication
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../auth-oauth2/" class="md-nav__link">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
OAuth2 Authentication
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1243,9 +1429,9 @@
|
|||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#automatic-sorting-based-on-subaddresses" class="md-nav__link">
|
||||
<a href="#subaddress-mailbox-routing" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Automatic Sorting Based on Subaddresses
|
||||
Automatic Sorting Based on Sub-addresses
|
||||
</span>
|
||||
</a>
|
||||
|
||||
|
@ -1330,10 +1516,10 @@
|
|||
|
||||
|
||||
|
||||
<input class="md-nav__toggle md-toggle md-toggle--indeterminate" type="checkbox" id="__nav_4_8_9" >
|
||||
<input class="md-nav__toggle md-toggle md-toggle--indeterminate" type="checkbox" id="__nav_4_8_7" >
|
||||
|
||||
|
||||
<label class="md-nav__link" for="__nav_4_8_9" id="__nav_4_8_9_label" tabindex="0">
|
||||
<label class="md-nav__link" for="__nav_4_8_7" id="__nav_4_8_7_label" tabindex="0">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
|
@ -1344,8 +1530,8 @@
|
|||
<span class="md-nav__icon md-icon"></span>
|
||||
</label>
|
||||
|
||||
<nav class="md-nav" data-md-level="3" aria-labelledby="__nav_4_8_9_label" aria-expanded="false">
|
||||
<label class="md-nav__title" for="__nav_4_8_9">
|
||||
<nav class="md-nav" data-md-level="3" aria-labelledby="__nav_4_8_7_label" aria-expanded="false">
|
||||
<label class="md-nav__title" for="__nav_4_8_7">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Email Forwarding
|
||||
</label>
|
||||
|
@ -1506,27 +1692,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../dovecot-master-accounts/" class="md-nav__link">
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Dovecot Master Accounts
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
@ -2141,9 +2306,9 @@
|
|||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#automatic-sorting-based-on-subaddresses" class="md-nav__link">
|
||||
<a href="#subaddress-mailbox-routing" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Automatic Sorting Based on Subaddresses
|
||||
Automatic Sorting Based on Sub-addresses
|
||||
</span>
|
||||
</a>
|
||||
|
||||
|
@ -2250,25 +2415,73 @@
|
|||
<span class="err">pipe</span> <span class="s">"external-program"</span><span class="p">;</span>
|
||||
</code></pre></div>
|
||||
<p>For more examples or a detailed description of the Sieve language have a look at <a href="http://sieve.info/examplescripts">the official site</a>. Other resources are available on the internet where you can find several <a href="https://support.tigertech.net/sieve#sieve-example-rules-jmp">examples</a>.</p>
|
||||
<h2 id="automatic-sorting-based-on-subaddresses"><a class="toclink" href="#automatic-sorting-based-on-subaddresses">Automatic Sorting Based on Subaddresses</a></h2>
|
||||
<p>It is possible to sort subaddresses such as <code>user+mailing-lists@example.com</code> into a corresponding folder (here: <code>INBOX/Mailing-lists</code>) automatically.</p>
|
||||
<div class="highlight"><pre><span></span><code><span class="kn">require</span> <span class="p">[</span><span class="s">"envelope"</span><span class="p">,</span> <span class="s">"fileinto"</span><span class="p">,</span> <span class="s">"mailbox"</span><span class="p">,</span> <span class="s">"subaddress"</span><span class="p">,</span> <span class="s">"variables"</span><span class="p">];</span>
|
||||
<h2 id="subaddress-mailbox-routing"><a class="toclink" href="#subaddress-mailbox-routing">Automatic Sorting Based on Sub-addresses</a></h2>
|
||||
<p>When mail is delivered to your account, it is possible to organize storing mail into folders by the <a href="../../account-management/overview/#sub-addressing">subaddress (tag)</a> used.</p>
|
||||
<div class="admonition example">
|
||||
<p class="admonition-title">Example: <code>user+<tag>@example.com</code> to <code>INBOX/<Tag></code></p>
|
||||
<p>This example sorts mail into inbox folders by their tag:</p>
|
||||
<div class="highlight"><span class="filename">docker-data/dms/config/user@example.com.dovecot.sieve</span><pre><span></span><code><span class="kn">require</span> <span class="p">[</span><span class="s">"envelope"</span><span class="p">,</span> <span class="s">"fileinto"</span><span class="p">,</span> <span class="s">"mailbox"</span><span class="p">,</span> <span class="s">"subaddress"</span><span class="p">,</span> <span class="s">"variables"</span><span class="p">];</span>
|
||||
|
||||
<span class="c1"># Check if the mail recipient address has a tag (:detail)</span>
|
||||
<span class="nb">if</span> <span class="nb">envelope</span> <span class="nt">:detail</span> <span class="nt">:matches</span> <span class="s">"to"</span> <span class="s">"*"</span> <span class="p">{</span>
|
||||
<span class="c1"># Create a variable `tag`, with the the captured `to` value normalized (SoCIAL => Social)</span>
|
||||
<span class="kd">set</span> <span class="nt">:lower</span> <span class="nt">:upperfirst</span> <span class="s">"tag"</span> <span class="s">"${1}"</span><span class="p">;</span>
|
||||
<span class="nb">if</span> <span class="err">mailbox</span><span class="nb">exists</span> <span class="s">"INBOX.${1}"</span> <span class="p">{</span>
|
||||
<span class="nb">fileinto</span> <span class="s">"INBOX.${1}"</span><span class="p">;</span>
|
||||
|
||||
<span class="c1"># Store the mail into a folder with the tag name, nested under your inbox folder:</span>
|
||||
<span class="nb">if</span> <span class="err">mailbox</span><span class="nb">exists</span> <span class="s">"INBOX.${tag}"</span> <span class="p">{</span>
|
||||
<span class="nb">fileinto</span> <span class="s">"INBOX.${tag}"</span><span class="p">;</span>
|
||||
<span class="p">}</span> <span class="nb">else</span> <span class="p">{</span>
|
||||
<span class="nb">fileinto</span> <span class="nt">:create</span> <span class="s">"INBOX.${tag}"</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre></div>
|
||||
<p>When receiving mail for <code>user+social@example.com</code> it would be delivered into the <code>INBOX/Social</code> folder.</p>
|
||||
</div>
|
||||
<details class="tip">
|
||||
<summary>Only redirect mail for specific tags</summary>
|
||||
<p>If you want to only handle specific tags, you could replace the envelope condition and tag assignment from the prior example with:</p>
|
||||
<div class="highlight"><span class="filename">docker-data/dms/config/user@example.com.dovecot.sieve</span><pre><span></span><code><span class="c1"># Instead of `:matches`, use the default comparator `:is` (exact match)</span>
|
||||
<span class="nb">if</span> <span class="nb">envelope</span> <span class="nt">:detail</span> <span class="s">"to"</span> <span class="s">"social"</span> <span class="p">{</span>
|
||||
<span class="kd">set</span> <span class="s">"tag"</span> <span class="s">"Social"</span><span class="p">;</span>
|
||||
</code></pre></div>
|
||||
<div class="highlight"><span class="filename">docker-data/dms/config/user@example.com.dovecot.sieve</span><pre><span></span><code><span class="c1"># Alternatively you can also provide a list of values to match:</span>
|
||||
<span class="nb">if</span> <span class="nb">envelope</span> <span class="nt">:detail</span> <span class="s">"to"</span> <span class="p">[</span><span class="s">"azure"</span><span class="p">,</span> <span class="s">"aws"</span><span class="p">]</span> <span class="p">{</span>
|
||||
<span class="kd">set</span> <span class="s">"tag"</span> <span class="s">"Cloud"</span><span class="p">;</span>
|
||||
</code></pre></div>
|
||||
<div class="highlight"><span class="filename">docker-data/dms/config/user@example.com.dovecot.sieve</span><pre><span></span><code><span class="c1"># Similar to `:matches`, except `:regex` provides enhanced pattern matching.</span>
|
||||
<span class="c1"># NOTE: This example needs you to `require` the "regex" extension</span>
|
||||
<span class="nb">if</span> <span class="nb">envelope</span> <span class="nt">:detail</span> <span class="nt">:regex</span> <span class="s">"to"</span> <span class="s">"^cloud-(azure|aws)$"</span> <span class="p">{</span>
|
||||
<span class="c1"># Normalize the captured azure/aws tag as the resolved value is no longer fixed:</span>
|
||||
<span class="kd">set</span> <span class="nt">:lower</span> <span class="nt">:upperfirst</span> <span class="s">"vendor"</span> <span class="s">"${1}"</span><span class="p">;</span>
|
||||
<span class="c1"># If a `.` exists in the tag, it will create nested folders:</span>
|
||||
<span class="kd">set</span> <span class="s">"tag"</span> <span class="s">"Cloud.${vendor}"</span><span class="p">;</span>
|
||||
</code></pre></div>
|
||||
<p><strong>NOTE:</strong> There is no need to lowercase the tag in the conditional as the <a href="https://thsmi.github.io/sieve-reference/en/test/core/envelope.html"><code>to</code> value is a case-insensitive check</a>.</p>
|
||||
</details>
|
||||
<details class="abstract">
|
||||
<summary>Technical Details</summary>
|
||||
<ul>
|
||||
<li>Dovecot supports this feature via the <em>Sieve subaddress extension</em> (<a href="https://datatracker.ietf.org/doc/html/rfc5233">RFC 5233</a>).</li>
|
||||
<li>Only a single tag per subaddress is supported. Any additional tag delimiters are part of the tag value itself.</li>
|
||||
<li>The Dovecot setting <a href="https://doc.dovecot.org/settings/core/#core_setting-recipient_delimiter"><code>recipient_delimiter</code></a> (default: <code>+</code>) configures the tag delimiter. This is where the <code>local-part</code> of the recipient address will split at, providing the <code>:detail</code> (tag) value for Sieve.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<p><code>INBOX</code> is the <a href="https://doc.dovecot.org/configuration_manual/namespace/">default namespace configured by Dovecot</a>.</p>
|
||||
<ul>
|
||||
<li>If you omit the <code>INBOX.</code> prefix from the sieve script above, the mailbox (folder) for that tag is created at the top-level alongside your Trash and Junk folders.</li>
|
||||
<li>The <code>.</code> between <code>INBOX</code> and <code>${tag}</code> is important as a <a href="https://doc.dovecot.org/configuration_manual/sieve/usage/#mailbox-names">separator to distinguish mailbox names</a>. This can vary by mailbox format or configuration. DMS uses <a href="https://doc.dovecot.org/admin_manual/mailbox_formats/maildir/#maildir-mbox-format"><code>Maildir</code></a> by default, which uses <code>.</code> as the separator.</li>
|
||||
<li><a href="https://doc.dovecot.org/settings/core/#core_setting-lmtp_save_to_detail_mailbox"><code>lmtp_save_to_detail_mailbox = yes</code></a> can be set in <code>/etc/dovecot/conf.d/20-lmtp.conf</code>:<ul>
|
||||
<li>This implements the feature globally, except for the tag normalization and <code>INBOX.</code> prefix parts of the example script.</li>
|
||||
<li>However, if the sieve script is also present, the script has precedence and will handle this task instead when the condition is successful, otherwise falling back to the global feature.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
<h2 id="manage-sieve"><a class="toclink" href="#manage-sieve">Manage Sieve</a></h2>
|
||||
<p>The <a href="https://doc.dovecot.org/admin_manual/pigeonhole_managesieve_server/">Manage Sieve</a> extension allows users to modify their Sieve script by themselves. The authentication mechanisms are the same as for the main dovecot service. ManageSieve runs on port <code>4190</code> and needs to be enabled using the <code>ENABLE_MANAGESIEVE=1</code> environment variable.</p>
|
||||
<div class="admonition example">
|
||||
<p class="admonition-title">Example</p>
|
||||
<div class="highlight"><pre><span></span><code><span class="c1"># compose.yaml</span>
|
||||
<span class="nt">ports</span><span class="p">:</span>
|
||||
<div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">ports</span><span class="p">:</span>
|
||||
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="s">"4190:4190"</span>
|
||||
<span class="nt">environment</span><span class="p">:</span>
|
||||
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">ENABLE_MANAGESIEVE=1</span>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue