I've ran into an unexpected problem relaying emails sent to a domain to another host. In ISPConfig I've added the mail domain and set a relayhost for it expecting all emails sent to the domain would be relayed to the set host. Except now I see errors in the logs saying the email address doesn't exist. So it looks like emails are not relayed but delivered local. Testing the query in mysql-virtual_sender-relayhost.cf (which is set in Postfix' main.cf for sender_dependent_relayhost_maps) does give me the relayhost I've set. If I delete the mail domain in ISPConfig and create a map file for sender_dependent_relayhost_maps by hand it does work as expected.
Do not add a mail domain if you want to use the system as a relay. A mail domain is for local delivery only, so when you add a mail domain you can not relay for that domain and have to add local mailboxes. Just add a relay domain and relay recipients in ISPConfig mail module (menu on the left side, near the bottom).
Then what's the function of the relay settings in a mail domain? When you add a relay domain and relay recipients you're not given an option where to relay to.
Thank you for clearing that up. But what about the relay settings in a mail domain? What is it used for?
This feature is not enabled by default. See Main Configuration > Mail. Then use, for example, third-party SMTP relays.
Plus, it's for relaying outgoing emails sent from mail users of this domain, not incoming emails for this domain.
Can't remember enabling it ever. Running this system for some years now and haven't had te need to relay incoming domains until now. Thanks for all the explanations. I'll look into the previous suggested relay options.