From 1d02760f66543e10c703da1ab32e6b98f8e2a149 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Sun, 12 Nov 2023 11:37:15 +0100 Subject: [PATCH] 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. --- mox-/lookup.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mox-/lookup.go b/mox-/lookup.go index 2be8a29..de15e41 100644 --- a/mox-/lookup.go +++ b/mox-/lookup.go @@ -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 {