fix incoming deliveries to the host-tlsrpt address

it was returning "550 not accepting mail for this domain" due to a missing
check in the address/account lookup function.
This commit is contained in:
Mechiel Lukkien 2023-11-12 11:37:15 +01:00
parent 8f55d0ada6
commit 1d02760f66
No known key found for this signature in database

View file

@ -36,12 +36,22 @@ func FindAccount(localpart smtp.Localpart, domain dns.Domain, allowPostmaster bo
return false
}
// Check for special mail host addresses.
if localpart == "postmaster" && postmasterDomain() {
if !allowPostmaster {
return "", "", config.Destination{}, ErrAccountNotFound
}
return Conf.Static.Postmaster.Account, "postmaster", config.Destination{Mailbox: Conf.Static.Postmaster.Mailbox}, nil
}
if localpart == Conf.Static.HostTLSRPT.ParsedLocalpart && domain == Conf.Static.HostnameDomain {
// Get destination, should always be present.
canonical := smtp.NewAddress(localpart, domain).String()
accAddr, ok := Conf.AccountDestination(canonical)
if !ok {
return "", "", config.Destination{}, ErrAccountNotFound
}
return accAddr.Account, canonical, accAddr.Destination, nil
}
d, ok := Conf.Domain(domain)
if !ok {