mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 13:04:38 +03:00
add config option to reject incoming deliveries with an error during the smtp transaction
useful when a catchall is configured, and messages to some address need to be rejected. would have been nicer if this could be part of a ruleset. but evaluating a ruleset requires us to have the message (so we can match on headers, etc). but we can't reject messages to individual recipients during the DATA command in smtp. that would reject the entire delivery attempt. for issue #156 by ally9335
This commit is contained in:
@ -1919,12 +1919,14 @@ func (c *conn) cmdRcpt(p *parser) {
|
||||
xsmtpUserErrorf(smtp.C550MailboxUnavail, smtp.SeAddr1UnknownDestMailbox1, "not accepting email for ip")
|
||||
}
|
||||
c.recipients = append(c.recipients, recipient{fpath, nil, nil})
|
||||
} else if accountName, alias, canonical, addr, err := mox.LookupAddress(fpath.Localpart, fpath.IPDomain.Domain, true, true); err == nil {
|
||||
} else if accountName, alias, canonical, dest, err := mox.LookupAddress(fpath.Localpart, fpath.IPDomain.Domain, true, true); err == nil {
|
||||
// note: a bare postmaster, without domain, is handled by LookupAddress. ../rfc/5321:735
|
||||
if alias != nil {
|
||||
c.recipients = append(c.recipients, recipient{fpath, nil, &rcptAlias{*alias, canonical}})
|
||||
} else if dest.SMTPError != "" {
|
||||
xsmtpServerErrorf(codes{dest.SMTPErrorCode, dest.SMTPErrorSecode}, dest.SMTPErrorMsg)
|
||||
} else {
|
||||
c.recipients = append(c.recipients, recipient{fpath, &rcptAccount{accountName, addr, canonical}, nil})
|
||||
c.recipients = append(c.recipients, recipient{fpath, &rcptAccount{accountName, dest, canonical}, nil})
|
||||
}
|
||||
|
||||
} else if Localserve {
|
||||
|
Reference in New Issue
Block a user