mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 07:14:40 +03:00
add flag to ruleset that indicates a message is forwarded, slightly modifying how junk analysis is done
part of PR #50 by bobobo1618
This commit is contained in:
@ -1039,10 +1039,6 @@ func prepareDynamicConfig(ctx context.Context, dynamicPath string, static config
|
||||
|
||||
for i, rs := range dest.Rulesets {
|
||||
checkMailboxNormf(rs.Mailbox, "account %q, destination %q, ruleset %d", accName, addrName, i+1)
|
||||
checkMailboxNormf(rs.AcceptRejectsToMailbox, "account %q, destination %q, ruleset %d, rejects mailbox", accName, addrName, i+1)
|
||||
if strings.EqualFold(rs.AcceptRejectsToMailbox, "inbox") {
|
||||
addErrorf("account %q, destination %q, ruleset %d: AcceptRejectsToMailbox cannot be set to Inbox", accName, addrName, i+1)
|
||||
}
|
||||
|
||||
n := 0
|
||||
|
||||
@ -1088,6 +1084,14 @@ func prepareDynamicConfig(ctx context.Context, dynamicPath string, static config
|
||||
addErrorf("ruleset must have at least one rule")
|
||||
}
|
||||
|
||||
if rs.IsForward && rs.ListAllowDomain != "" {
|
||||
addErrorf("ruleset cannot have both IsForward and ListAllowDomain")
|
||||
}
|
||||
if rs.IsForward {
|
||||
if rs.SMTPMailFromRegexp == "" || rs.VerifiedDomain == "" {
|
||||
addErrorf("ruleset with IsForward must have both SMTPMailFromRegexp and VerifiedDomain too")
|
||||
}
|
||||
}
|
||||
if rs.ListAllowDomain != "" {
|
||||
d, err := dns.ParseDomain(rs.ListAllowDomain)
|
||||
if err != nil {
|
||||
@ -1095,6 +1099,11 @@ func prepareDynamicConfig(ctx context.Context, dynamicPath string, static config
|
||||
}
|
||||
c.Accounts[accName].Destinations[addrName].Rulesets[i].ListAllowDNSDomain = d
|
||||
}
|
||||
|
||||
checkMailboxNormf(rs.AcceptRejectsToMailbox, "account %q, destination %q, ruleset %d, rejects mailbox", accName, addrName, i+1)
|
||||
if strings.EqualFold(rs.AcceptRejectsToMailbox, "inbox") {
|
||||
addErrorf("account %q, destination %q, ruleset %d: AcceptRejectsToMailbox cannot be set to Inbox", accName, addrName, i+1)
|
||||
}
|
||||
}
|
||||
|
||||
// Catchall destination for domain.
|
||||
|
Reference in New Issue
Block a user