Thanks Max, I’m making something similar to a disposable email service, which is why I need to accept mail for any user. There’s still some validation for domains, etc, so I’m not too worried about accepting everything. I was looking to use Cyrus, which has a setting to create mailboxes as needed, but I’m preferring Dovecot for other reasons. As I’m using Postgres for the DB, I think I’m okay with doing an update for every mail - the service isn’t particularly high volume and updates would be the equivalent of just adding users to Dovecot through some other means.
I’m leaning towards a content filter though, as I am planning on adding some other functionality in the future. (e.g. handling verification emails from certain users, etc. I should look at how majordomo works for this list…). With the content filter, I could create the user if needed, then put the mail back into the queue for postfix to lmtp over to Dovecot. Though that would also be possible with your two-step lmtp idea, so I’ll have a look at my options for that. Thanks again for the reply, Felix > On 2 Jan 2022, at 20:37, Max-Julian Pogner <max-jul...@pogner.at> wrote: > > Hi, > > > from a SMTP protocol point of view, postfix just ingests mail on the one end, > and hands it over on the other end. > > What you are describing is, that postfix will accept any and all mail. That > parts seems easy enough, and does not require any database or speaking with > dovecot (as the result will be always to accept the mail). > Just set in postfix main.cf: `virtual_mailbox_maps = static:OK` > (not, that i would recommend it) > > And then postfix will hand the mail over at the other end. For this, you > could implement some script or program that is specified in postfix config in > place of the dovecot-lda program; see Howto section "Virtual users" here: > https://wiki.dovecot.org/LDA/Postfix > Or you could implement an LMTP daemon, that accepts mail from postfix in > place of the dovecot lmtp service. See HowTo here: > https://doc.dovecot.org/configuration_manual/howto/postfix_dovecot_lmtp/ > > Your script, program or daemon would do something that ensures all mail is > accepted by dovecot, and then forward the mail to the actual dovecot lda or > lmtp. > > > Needless to say, that i cannot fathom why you would want to do such a thing. > Also i can see ample opportunity to be a source of backscatter if something > fails. And executing a program (possibly in parallel) that on the fly changes > the config of dovecot for every incoming mail, seems unwise at least. > However, here's where i would start: fiddling with whatever postfix uses as > virtual_transport. > > > ~~ Max > > > On 02/01/2022 00:13, Felix Ingram wrote: >> Hello all, >> I am creating an email service where I need to accept email for any address >> at my domains. The postfix part of this has been easy enough but I now want >> to send the mails through to Dovecot. This all works as expected if I have a >> user already configured in Dovecot but in the majority of cases I won’t have >> until a new email arrives. (The service will be similar to a temporary email >> service, and I won’t know the addresses users are using ahead of time.) >> My question is: where is the best place to create my new Dovecot users from >> Postfix? I am using Postgres as the Dovecot users DB, so I have tried with a >> stored procedure in my pgsql virtual aliases lookup that inserts a row but >> I’m wondering if there’s a better place to do it. I thinking maybe in a >> policy server or a content filter but am open to any suggestions. I’m >> looking to have some separation of concerns - at the moment it feels like >> I’m overloading the alias lookup more than I should. >> Thanks in advance for any ideas, >> Felix