Mail alias with wildcard

My YunoHost configuration

Hardware: x64 vps
Internet access: in a datacenter
**YunoHost version: **
yunohost: 3.2.1
yunohost-admin: 3.2.1
moulinette: 3.2.0
ssowat: 3.2.0
Have you personalized your yunohost with some specifics configurations or do you use only the yunohost cli/webadmin tool ? basic

Description of my problem

Hello all,

I would like to add a mail alias with a wildcard to an account, so that it receives all mail in the form “”. I tried adding a mail alias in the form “mailbox*” but I get the error “Error: Invalid argument ‘add_mailalias’: Must be a valid email address (e.g.”

Is there a way to setup such a system? I would also be able to work with a catch-all mailbox, which receives all the messages sent to the server.

Thanks to everyone!

1 Like

I, too, would like to know whether wildcard or catch-all email addressing is doable. Thank you!

I tried to create an alias * on the demo site, but it’s rejected

Would be great if there’s official support of wildcard email alias, thanks!

1 Like

Yes it will be a good feature for me too. :grinning:
Is there another way to do this ?

For the moment, only the + selector support is available.

SO email+XXXXX@domain.tld

BUT you can do it “by hand” and with cli, you need to change /etc/postfix/ with:

virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman,ldap:/etc/postfix/,regexp:/etc/postfix/aliases-regexp

Create a file /etc/postfix/aliases-regexp like this one:


Use postmap on it

postmap /etc/postfix/aliases-regexp

Define in yunohost admin an alias on a user.

Restart postfix

systemctl restart postfix

Thank @ljf I will try it :smiley:
(I didn’t see before you made an answer !!)

This worked! (Mail on main domain, yunohost on subdomain - #3 by samuel-ynh)

But unfortunately only for receiving mails, if I try to send a mail from a wildcard alias I get:
Sender address rejected: not owned by user

Do you have an idea on how to send mails from wildcard aliases?

Thanks in advance!

J’ai eu quelques erreurs de correspondances des regex. J’ai compris qu’il faut bien borner la règle.
Exemple :
va correspondre à :
mais aussi à :
Si on ne veut pas alors il faut plutôt écrire /^mailbox.*@example\.com/

Quelques liens utiles également :

Hello, to make it working I commented the line : reject_sender_login_mismatch, in the /etc/postfix/

# Requirements for the sender address
smtpd_sender_restrictions =
# reject_sender_login_mismatch,

This maybe a security choice.

Apriori this means that anybody can send an email using anybody’s identity so yeah … “Couldn’t figure out what’s wrong with the keys, so we removed the lock and now anybody can enter the house, problem solved” :sweat_smile:


another useful link for postfix regex : postfix_virtual_mail_addresses_with_regular_expressions [pswiki]

@Aleks :rofl: