Yunohost Catch-All mail address

I want to have a catch-all mail-address in yunohost so I can send a mail to my non-existent address foo@example.com.
Until recently I dif it like this in LDAP:

version: 1

# Entry 1: uid=example.com,ou=aliases,dc=yunohost,dc=org
dn: uid=example.com,ou=aliases,dc=yunohost,dc=org
cn: me@example.com
mail: @example.com
maildrop: me
objectclass: mailAccount
objectclass: inetOrgPerson
objectclass: top
sn: me@example.com
uid: example.com

Since the last update, this does not work anymore. I did not get any mails to my catch-all address, instead I got this in my mail.log:

 /var/log/mail.info.1:Mar 27 16:09:27 postfix/smtpd[7783]: NOQUEUE: reject: RCPT from static.atdhq.com[173.230.139.58]: 550 5.1.1 <foo@example.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<admin@mail.com> to=<foo@example.com> proto=ESMTP helo=<static.atdhq.com>

I now fixed this by just adding a @example.com mail-setting in my dn:

version: 1

# Entry 1: uid=firstname,ou=users,dc=yunohost,dc=org
dn: uid=firstname,ou=users,dc=yunohost,dc=org
cn: firstname lastname
displayname: firstname lastname
gidnumber: 61161
givenname: firstname
homedirectory: /home/firstname
loginshell: /bin/false
mail: user@example.com
mail: root@example.com
mail: admin@example.com
mail: webmaster@example.com
mail: postmaster@example.com
mail: @example.com                   # relevant line
maildrop: me
mailuserquota: 0
objectclass: mailAccount
objectclass: inetOrgPerson
objectclass: posixAccount
objectclass: userPermissionYnh
sn: Lastname
uid: Firstname
uidnumber: 61161

This seems to work fine.

Is this the correct way to do this? Any other ideas? Ideas, why the first method doesn’t work anymore?

Probably because your previous custom user does not have the associated group permission for mail. c.f. https://github.com/YunoHost/yunohost/blob/stretch-unstable/data/templates/postfix/plain/ldap-accounts.cf#L4 if you speak ldap queries fluently

1 Like

Thanks @Aleks, that was it.

The updated LDIF has two extra lines added:

version: 1

# Entry 1: uid=firstname,ou=users,dc=yunohost,dc=org
dn: uid=firstname,ou=users,dc=yunohost,dc=org
cn: firstname lastname
displayname: firstname lastname
gidnumber: 61161
givenname: firstname
homedirectory: /home/firstname
loginshell: /bin/false
mail: user@example.com
mail: root@example.com
mail: admin@example.com
mail: webmaster@example.com
mail: postmaster@example.com
mail: @example.com                   # relevant line
maildrop: me
mailuserquota: 0
objectclass: mailAccount
objectclass: inetOrgPerson
objectclass: posixAccount
objectclass: userPermissionYnh
sn: Lastname
uid: Firstname
objectclass: userPermissionYnh
permission: cn=mail.main,ou=permission,dc=yunohost,dc=org

A question: What’s the better way to do this? This alias that I created, or my user with the @example.com mail-address?
If I use the second method, I can even send mails from any foononexistenst@example.com address and it won’t get rejected.

Second question: should this be documented somewhere? I can create a PR.