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

Reply via email to