Thanks, that was very helpful. This has me wondering: if a message is sent to multiple recipients and some are valid and others are not, what is the Right Thing to do?
rg P.S. Just FYI: > I'm not sure what the problem is with Postfix and sqlite See http://postfix.1071664.n5.nabble.com/What-is-the-right-way-to-update-a-postfix-sqlite-database-td109636.html#a109659 if you really want to know. The TL;DR is that postfix does not set a non-zero value for pragma busy_timeout and so any simultaneous access results in an immediate fatal error in postfix. On Jul 11, 2021, at 1:54 PM, Bill Cole <postfixlists-070...@billmail.scconsult.com> wrote: > On 2021-07-11 at 15:46:45 UTC-0400 (Sun, 11 Jul 2021 12:46:45 -0700) > Ron Garret <r...@flownet.com> > is rumored to have said: > >> On Jul 11, 2021, at 12:22 PM, Matus UHLAR - fantomas <uh...@fantomas.sk> >> wrote: >> >>> >>>> The problem is that a rejected recipient produces a mailer-daemon reply. >>> >>> only if you accept mail for such recipient. >> >> Ah. That may be my problem then. I’m using Dovecot via LMTP for local >> delivery. I thought that postfix would receive information about >> non-existent users via that protocol, but I guess it doesn’t and ends up >> just accepting everything. > > Postfix doesn't know about non-existent users that are relayed via LMTP until > it has queued and accepted the message. Postfix's SMTP/LMTP client program > picks up the queued message, tries to deliver it to Dovecot's LMTP server, > and fails. That's when the Postfix bounce daemon takes over, constructing and > queueing a bounce message. > >> So… is dovecot actually the thing that is generating the emails from >> mailer-daemon? > > No. Dovecot is the thing telling Postfix that the address is bad. > >> Is there a way to get this setup to do the Right Thing? If not, why is LMTP >> even supported, because it seems to me that anyone who uses it will have >> this problem. > > 1. Use {local,relay}_recipient_maps and/or virtual_{mailbox,alias}_maps and > reject_unlisted_recipients. You can either talk directly to the DB for the > map or at smaller scales you could just periodically generate a static list > for Postfix to check at SMTP time. > > 2. Use reject_unverified_recipients. This is a generally bad idea on > submission servers (port 465/587) unless you do something to limit it to > recipients in local, virtual, and relay classes. Since that's all you should > be seeing on a true SMTP (port 25) server, it's fine to apply it to all > messages on your inbound mail stream. > >> (FYI, the reason I want to use LMTP is that I’m using sqlite for my user db, >> but postfix does not play well with sqlite when other programs are trying to >> access the same DB. I didn’t want to duplicate the user DB (I’m a big >> believer in the DRY principle) so I wanted to localize DB access to a single >> process, and that process has to be Dovecot.) > > I'm not sure what the problem is with Postfix and sqlite, but extracting a > suitable static map from the DB periodically should be a SMOP with one SELECT > and some trivial formatting, if you don't want Postfix contending with > Dovecot synchronously. > > > -- > Bill Cole > b...@scconsult.com or billc...@apache.org > (AKA @grumpybozo and many *@billmail.scconsult.com addresses) > Not Currently Available For Hire