Proper catch-all email instructions

What type of hardware are you using: Other(?)
What YunoHost version are you running: Powered by YunoHost 12.1.41.2 (stable)
How are you able to access your server: The webadmin
SSH

Describe your issue

What is the proper way to configure a catch-all email alias?
So you would get at catch-all@domain.xx any mail sent to @domain.xx
except the already existing mailboxes, like john@domain.xx and mary@domain.xx

There are a lot of posts about this, but seems things have changed and I don’t know which one is the proper instructions

If somebody points me to the proper forum post/instructions, I can document and collaborate with YNH doc

thanks!

Share relevant logs or error messages

no logs

I can tell that my way by adding @example.com to the mail-attribute in LDAP for my user still works.

I still use a reconf hook to modify the postfix configuration as described here. This has the advantage that editing the user in yunohost does not remove the catch-all entry, but the disadvantage that one manually needs to update /etc/postfix/my-catchalls.

As for documentation, it seems a bit dangerous to add any of these workarounds there and suggest that more people use them. A “proper” solution or support in the yunohost admin interface would be much better I guess. But I don’t even know who would be the right developer / team member to ask and support (financially) for making it happen.

ok I understand… then maybe the question is what is the less harmful/recommended way of doing it manually, as situation is right now?

So, I think @m4lvin solution is the best and most updated at this day, so I would try to document the steps, because I was personally confused with all the info on the original post. Please @m4lvin correct me.

Edit your
/etc/postfix/main.cf adding this line:

virtual_alias_maps = hash:/etc/postfix/my-catchalls,ldap:/etc/postfix/ldap-aliases.cf,ldap:/etc/postfix/ldap-groups.cf

And this to /etc/postfix/my-catchalls: (in this example, both alice@example.com and alice.wonderland@example.com go to alice@example.com, and EVERY OTHER mail goes to bob@example.com)

alice@example.com             alice@example.com
alice.wonderland@example.com  alice@example.com
@example.com                  bob@example.com

then run
postmap /etc/postfix/my-catchalls

Now, If you need to create a new user, you will have to delve deeper, please see original post:

This looks correct to me!

And yes, the tricky part is that whenever you add another user later then you need to update the my-catchalls file to ensure they get their mails (as an exception to the catchall).

One practical addition: any time /etc/postfix/my-catchalls changes—whether adding a user, alias, or exception—rerun postmap /etc/postfix/my-catchalls. It’s easy to forget that step after the initial setup, and then the catch-all/exceptions silently keep using the old map. If you document this, a small note about checking postmap -q for a couple of addresses would make the workaround easier to verify.

I deleted one of the lines in the main.cf config… It was the one I guess you used formerly but for a solution that didn’t work ( virtual_mailbox_maps)