Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.
If not already configured, you will need (at least) to setup a minimal HTTP vhost config for each name.
In there, you can process the HTTP authentication requests for each and also redirect all other requests to HTTPS.
You can issue individual certs for each name or one cert that contains both names (your choice - either one will work).
[I will skip the normal HTTPS implementation for web services - there are plenty of online docs for that.]
Once you have a cert that covers the name used by Dovecot/Postfix, you simply need to understand where and how Dovecot/Postfix use certificates.
Here are some starting points for that: https://wiki.dovecot.org/SSL/DovecotConfiguration http://www.postfix.org/TLS_README.html
From there you can move to automating the certificate renewal process to include restarting Dovecot/Postfix after each successful renewal.