I recently needed to create an alias who redirect to an email not manage by my yunohost instance.
To do it, I wrote into the LDAP which is read by Postfix (the mail system).
Firstly i created a file with this command
containing the declaration of the “alias” organisational unit, and an entry with it like that
dn: ou=alias,dc=yunohost,dc=org objectClass: organizationalUnit objectClass: top ou: alias dn: uid=mail1,ou=alias,dc=yunohost,dc=org uid: mail1 uid: jean objectClass: inetOrgPerson objectClass: mailAccount cn: Jean DUPONT sn: Jean maildrop: firstname.lastname@example.org mail: email@example.com
Then I run this command to add these element to the ldap
sudo ldapadd -x -D cn=admin,dc=yunohost,dc=org -W -f aliasmail
And the redirection was done, if I sent a mail to firstname.lastname@example.org it was resent to email@example.com.
Note: if you need a second alias/redirection, you don’t need to put the first part of the file because it is already in the ldap.
Note2: you can redirect an alias to several mail by adding several “maildrop” line.