Skip to content

Commit

Permalink
mod_smtp_delivery_external: Improve queuing algorithm.
Browse files Browse the repository at this point in the history
This improves the queuing mechanism in several ways:

* Use exponential backoff for messages, rather than
  retrying at the same fixed interval each time.
* Improve queue run handling to provide more information
  about queue runs in debug messages and CLI commands.
* Allow a queue run to be filtered by certain properties.

This work anticipates future support for RFC 1985 ETRN.

No major overhauling has been done at this time to either
the queue file format (injecting metadata into the beginning)
or the serialization of queue processing.

This also fixes the following bugs:
* Ignore static routes for IP addresses.
* Properly detect domain literals that contain IP addresses.
  • Loading branch information
InterLinked1 committed Jan 27, 2024
1 parent 356e700 commit 9233077
Show file tree
Hide file tree
Showing 2 changed files with 353 additions and 35 deletions.
11 changes: 9 additions & 2 deletions configs/net_smtp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ notifyqueue=no ; Whether to notify users that a queued message they have attempt
; The benefit of this is that users are notified a message they sent hasn't been successfully delivered, in advance
; of delivery ultimately failing and triggering a final nondelivery response to return the message to them.
; Default is no.
queueinterval=900 ; Seconds between queue retries. Default is 900, minimum is 60.
maxretries=10 ; Number of times to attempt to deliver a message. If exceeded, message will be returned.
queueinterval=900 ; Seconds between queue retries. Minimum is 60. Default is 60. Recommended values are 60-600.
; Note that increasing this will increase the retry times initially,
; but since exponential backoff is used for delivery retry, this setting will only affect shorter retries.
; Queue retries will thus be lowerbound by this setting, but any retires that would have happened further apart are not affected.
maxretries=10 ; Number of times to attempt to deliver a message. If exceeded, message will be returned. Default and recommended value is 10.
; It is recommended that this be at least 10, to retry delivery for at least a few days before returning to sender.
maxage=86400 ; Maximum age of a queued email that will be retried, before being returned.
maxsize=300000 ; Maximum size of an email message, in bytes. Messages larger than this will be rejected. Default is 300,000 (appx. 300 KB)
requirefromhelomatch=yes ; Require the MAIL FROM domain to match the domain advertised by the sending server in HELO/EHLO.
Expand Down Expand Up @@ -83,6 +87,9 @@ loglevel=5 ; Log level from 0 to 10 (maximum debug). Default is 5.
; Only static IP addresses (no hostnames or CIDR ranges) are allowed for values in this section.
; Domains must be explicitly enumerated; no wildcards for subdomains.
;
; Static relays may only be used in lieu of MX lookups that would have been performed, if configured,
; i.e. messages addressed to an IP address (domain literal) do not use static routes.
;
; On the mail server for domains which are proxied through this host, the '*' rule can be used to route all outgoing mail through another host.
;example.com = 10.1.1.5
;example.net = 10.1.1.5,10.1.1.6 ; Try 10.1.1.5 first, then 10.1.1.6 as a fallback (like with higher priority MX records)
Expand Down
Loading

0 comments on commit 9233077

Please sign in to comment.