taking note that we *start* the code with the closing </VirtualHost> because the CUSTOM4 token is before the trailing VH in the virtual_host2.conf template.
The above is for port http:80, but similar code can be used in virtual_host2_secure.conf.CUSTOM.4.post if you want it for https on the domain, you'd just need to add the lines after the opening <VH>:
2) Then run
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
to rewrite the httpd.conf files.
3) You'll also need to setup the dns portition.
cp dns_a.conf custom
echo "webmail=|IP|" >> dns_a.conf
This will setup the webmail A record for new dns zones. For existing dns zones, you'll have to manually add the webmail A record to point to the domains IP.