Sorry for the late reply.
After long reading and digging in the internet I really managed to get a solution with transport_maps, so great thanks for the hint!
If someone has a similar setup here is what i've done and which is working:
Some filenames might be missleading and I am not a postfix expert, so no guarantee that this should be used on a productive environment.
main.cf of postfix:
Comment out mail domains, as we don't have full domains hosted by postfix, we do everthing by hand:
#virtual_mailbox_domains = mysql:/etc/postfix/grommunio-virtual-mailbox-domains.cf
Add transport maps:
transport_maps = mysql:/etc/postfix/grommunio_transport_map_prim.cf, mysql:/etc/postfix/grommunio_transport_map_alias.cf
Which are mainly mysql calls to grommunio database, check if email (primary_mail) is in database or aliasmail is in database. If so, then the return result is result_format = smtp:[::1]:24
, which means that we transport the mail to grommunio, if the email is not in database then the mail will be transported by sender dependent relay (which is my relay from hoster where other emails from my domain are hosted. )
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = lmdb:/etc/postfix/sender_relay
smtp_sasl_password_maps = lmdb:/etc/postfix/sasl_passwd
Additionally as I import mails with fetchmail and I want to have a catchall on a specific mail account, I defined virtual alias maps:
virtual_alias_maps =lmdb:/etc/postfix/catchall , mysql:/etc/postfix/grommunio-virtual-mailbox-alias-maps.cf, mysql:/etc/postfix/grommunio-virtual-mailbox-alias-emails.cf
where the first file is the catchall database, the second one reacts on primary_email, the third on mailalias.
The files look like:
grommunio_transport_map_alias.cf:
user = grommunio
password = [mysql password]
hosts = localhost
dbname = grommunio
query = (SELECT aliasname FROM aliases WHERE aliasname='%s')
result_format = smtp:[::1]:24
grommunio_transport_map_prim.cf:
user = grommunio
password = [mysql pasword]
hosts = localhost
dbname = grommunio
query = (SELECT primary_email FROM users WHERE primary_email='%s')
result_format = smtp:[::1]:24
grommunio-virtual-mailbox-alias-emails.cf:
user = grommunio
password = [mysql password]
hosts = localhost
dbname = grommunio
query = SELECT primary_email FROM users WHERE primary_email='%s'
grommunio-virtual-mailbox-alias-maps.cf:
user = grommunio
password = [mysql password]
hosts = localhost
dbname = grommunio
query = SELECT mainname FROM aliases WHERE aliasname='%s'
catchall:
@example.de home@example.de