How to setup a mailbox with custom domains?

I have a couple of domains for all kinds of different projects, some on shared hosting (with a mailbox solution from the provider) and some on a private VPS.
My goal is to move everything to my VPS but the problem I currently have is that I don’t know how to setup a mail server solution. Any advice would help me a lot, do you have your own mail server solution or are you using a 3rd party service?
Maybe some requirements that I currently have:

Supports multiple domains
SMTP so I can send mails from my backend application
Can create multiple mailboxes if needed

I understand that there is not 1 perfect solution but any tips are welcome to help me reach my goal.

Link: https://dev.to/glennmen/how-to-setup-a-mailbox-with-custom-domains-4oj4