You can create a dummy mail alias example@webmail.domain1.com for each domain that you have. Then go to the web section of the admin interface and configure a custom web path there. Finally put an index.php file into the directory on the server and fill its contents with:
You can also create a single folder on the server, for example webmail-redirect and put the file in there. Then after doing the admin interface step you can delete the folder you had to create and create a symbolic link to the webmail-redirect folder instead.
cd /home/user-data/www
rmdir webmail.domain1.com
ln -s webmail-redirect webmail.domain1.com
This way you will have the php file on the server just once and all domains will use the same redirect, which makes it easier to change later.
Apologies for reviving a super old topic, but I just wanted to say that @murgero’s HTML redirect also served the purpose of fixing a related annoyance of mine. I modified the HTML code as follows:
This made it so that box.example.com redirects to box.example.com/admin, which is convenient because web browsers only autocomplete the domain name, so I don’t have to manually type the “/admin” at the end anymore.
FWIW I think the above code might be a reasonable default for the default subdomains, rather than the “This is a Mail in a Box” text, which makes more sense for custom, per-user subdomains.