On Wed, 27 Oct 2021, Felix Ingram wrote:
[...]
People would be able to send email to addresses that match the following format:
user1@foobar.mydomain.com user2@foobar.mydomain.com
user1@barbaz.mydomain.com user2@barbaz.mydomain.com
[...]
I will be creating a web interface for users to get/set their credentials, so can add those users on an adhoc basis, but I will need to have the "foobar", "barbaz", etc users created whenever an email arrives (we won't know ahead of time).
[...]
Further to the responses you have received already, I'd like to note that if you want to receive mail at {alias}@{user}.mydomain.com then, at the time of *sending* the e-mail there needs to be an MX record for user, as otherwise the sender won't be able to connect to your (postfix) server.
That means that the users will have to exist *before* postfix receives the message, and thus clearly before dovecot receives it.. so you may have to reconsider your requirement of adding users of on-the-fly.
Of course, you could use a wildcard MX, but my understanding is that this can cause problems (but I'd have to check in RFC1912 and RFC4592).
Cheers.