Customising hostname sent in email links for app deeplinking

Is it possible to alter the links sent via Discourse in emails without changing the email templates (base url) ?

In our scenario, we have developed a mobile app which uses deeplinking so https_example.com will open the app. From the app, the user can access our (self hosted) forum which is available at https_forum.example.com and is launched via the app and opens the system browser and uses Discourse Connect for SSO between the app and forum.

What we want to acheive is to keep the base URL of the forum as https_forum.example.com but change the links in the email to https_example.com/forumlink/<some_topic>. When a user receives a email and clicks the link, they will be redirected to the app which will open on the device and then we will log the user in, and then open the forum in the system browser and point the user to https_forum.example.com/<some_topic>.

Does this require a customisation or can this be done through existing functionality ? We could look to customise a particular component that may centrally handle all email sending (e.g. to use an env vaiable) if that is possible. However, not sure if this customisation will get wiped out if we upgrade. We are using self-hosted docker image standalone template.

The whitelisted app can be deployed in such a way that it associates links correctly and deep links into the Discourse instance via the app. Why does your app have to be different?