add option to ruleset to accept incoming spammy messages to a configured mailbox

this is based on @bobobo1618's PR #50. bobobo1618 had the right idea, i tried
including an "is forwarded email" configuration option but that indeed became
too tightly coupled. the "is forwarded" option is still planned, but it is
separate from the "accept rejects to mailbox" config option, because one could
still want to push back on forwarded spam messages.

we do an actual accept, delivering to a configured mailbox, instead of storing
to the rejects mailbox where messages can automatically be removed from.  one
of the goals of mox is not pretend to accept email while actually junking it.
users can still configure delivery to a junk folder (as was already possible),
but aren't deleted automatically. there is still an X-Mox-Reason header in the
message, and a log line about accepting the reject, but otherwise it is
registered and treated as an (smtp) accept.

the ruleset mailbox is still required to keep that explicit. users can specify
Inbox again.

hope this is good enough for PR #50, otherwise we'll change it.
This commit is contained in:
Mechiel Lukkien
2023-08-09 18:03:29 +02:00
parent 383fe4f53a
commit 9c31789c56
9 changed files with 98 additions and 35 deletions

View File

@ -715,16 +715,25 @@ describe-static" and "mox config describe-domains":
HeadersRegexp:
x:
# Influence the spam filtering, this does not change whether this ruleset applies
# to a message. If this domain matches an SPF- and/or DKIM-verified (sub)domain,
# the message is accepted without further spam checks, such as a junk filter or
# DMARC reject evaluation. DMARC rejects should not apply for mailing lists that
# are not configured to rewrite the From-header of messages that don't have a
# passing DKIM signature of the From-domain. Otherwise, by rejecting messages, you
# may be automatically unsubscribed from the mailing list. The assumption is that
# mailing lists do their own spam filtering/moderation. (optional)
# Influence spam filtering only, this option does not change whether a message
# matches this ruleset. If this domain matches an SPF- and/or DKIM-verified
# (sub)domain, the message is accepted without further spam checks, such as a junk
# filter or DMARC reject evaluation. DMARC rejects should not apply for mailing
# lists that are not configured to rewrite the From-header of messages that don't
# have a passing DKIM signature of the From-domain. Otherwise, by rejecting
# messages, you may be automatically unsubscribed from the mailing list. The
# assumption is that mailing lists do their own spam filtering/moderation.
# (optional)
ListAllowDomain:
# Influence spam filtering only, this option does not change whether a message
# matches this ruleset. If a message is classified as spam, it isn't rejected
# during the SMTP transaction (the normal behaviour), but accepted during the SMTP
# transaction and delivered to the specified mailbox. The specified mailbox is not
# automatically cleaned up like the account global Rejects mailbox, unless set to
# that Rejects mailbox. (optional)
AcceptRejectsToMailbox:
# Mailbox to deliver to if this ruleset matches.
Mailbox: