Skip to content

Commit

Permalink
Merge #2255
Browse files Browse the repository at this point in the history
2255: Create a polite and turtle delivery queue to accommodate destinations that expect emails to be sent slowly r=mergify[bot] a=nextgens

## What type of PR?

Feature

## What does this PR do?

Create a polite and turtle delivery queue to accommodate destinations that expect emails to be sent slowly

### Related issue(s)
- closes #2213

## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [x] In case of feature or enhancement: documentation updated accordingly
- [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.


Co-authored-by: Florent Daigniere <nextgens@freenetproject.org>
  • Loading branch information
bors[bot] and nextgens committed Mar 18, 2022
2 parents cbb2112 + 66b660d commit 68d3d67
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/postfix/conf/main.cf
Expand Up @@ -80,7 +80,7 @@ virtual_mailbox_maps = ${podop}mailbox

# Mails are transported if required, then forwarded to Dovecot for delivery
relay_domains = ${podop}transport
transport_maps = ${podop}transport
transport_maps = lmdb:/etc/postfix/transport.map, ${podop}transport
virtual_transport = lmtp:inet:{{ LMTP_ADDRESS }}

# Sender and recipient canonical maps, mostly for SRS
Expand Down
16 changes: 16 additions & 0 deletions core/postfix/conf/master.cf
Expand Up @@ -15,6 +15,22 @@ outclean unix n - n - 0 cleanup
-o header_checks=pcre:/etc/postfix/outclean_header_filter.cf
-o nested_header_checks=

# Polite policy
polite unix - - n - - smtp
-o syslog_name=postfix-polite
-o polite_destination_concurrency_limit=3
-o polite_destination_rate_delay=0
-o polite_destination_recipient_limit=20
-o polite_destination_concurrency_failed_cohort_limit=10

# Turtle policy
turtle unix - - n - - smtp
-o syslog_name=postfix-turtle
-o turtle_destination_concurrency_limit=1
-o turtle_destination_rate_delay=1
-o turtle_destination_recipient_limit=5
-o turtle_destination_concurrency_failed_cohort_limit=10

# Internal postfix services
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
Expand Down
7 changes: 4 additions & 3 deletions core/postfix/start.py
Expand Up @@ -74,9 +74,10 @@ def is_valid_postconf_line(line):
else:
conf.jinja("/conf/mta-sts-daemon.yml", os.environ, "/etc/mta-sts-daemon.yml")

if not os.path.exists("/etc/postfix/tls_policy.map.lmdb"):
open("/etc/postfix/tls_policy.map", "a").close()
os.system("postmap /etc/postfix/tls_policy.map")
for policy in ['tls_policy', 'transport']:
if not os.path.exists(f'/etc/postfix/{policy}.map.lmdb'):
open(f'/etc/postfix/{policy}.map', 'a').close()
os.system(f'postmap /etc/postfix/{policy}.map')

if "RELAYUSER" in os.environ:
path = "/etc/postfix/sasl_passwd"
Expand Down
18 changes: 17 additions & 1 deletion docs/faq.rst
Expand Up @@ -476,6 +476,22 @@ Any mail related connection is proxied by nginx. Therefore the SMTP Banner is al

.. _`1368`: https://github.com/Mailu/Mailu/issues/1368

My emails are getting rejected, I am being told to slow down, what can I do?
````````````````````````````````````````````````````````````````````````````

Some email operators insist that emails are delivered slowly. Mailu maintains two separate queues for such destinations: ``polite`` and ``turtle``. To enable them for some destination you can creating an override at ``overrides/postfix/transport.map`` as follow:

.. code-block:: bash
yahoo.com polite:
orange.fr turtle:
Re-starting the smtp container will be required for changes to take effect.

*Issue reference:* `2213`_.

.. _`2213`: https://github.com/Mailu/Mailu/issues/2213

My emails are getting defered, what can I do?
`````````````````````````````````````````````

Expand All @@ -488,7 +504,7 @@ If delivery to a specific domain fails because their DANE records are invalid or
domain.example.com may
domain.example.org encrypt
The syntax and options are as described in `postfix's documentation`_. Re-creating the smtp container will be required for changes to take effect.
The syntax and options are as described in `postfix's documentation`_. Re-starting the smtp container will be required for changes to take effect.

.. _`postfix's documentation`: http://www.postfix.org/postconf.5.html#smtp_tls_policy_maps

Expand Down
1 change: 1 addition & 0 deletions towncrier/newsfragments/2213.feature
@@ -0,0 +1 @@
Create a polite and turtle delivery queue to accommodate destinations that expect emails to be sent slowly

0 comments on commit 68d3d67

Please sign in to comment.