Setting up an email server is somewhat easy. Ensuring that other servers consider yours as legitimate that is the problem.
Obviously GMail is such a giant that email providers have to be very careful when blocking it, but enough spam comes from there that receivers clearly use some heuristics to block some of it. I’ve even received multiple rejection notices because the GMail server my email was sent through happened to be on a blacklist!
I switched last year to sending directly from my VPS. It was partly for privacy from Google, but moreso so I could enforce outgoing TLS. For the first few days they went to spam boxes or moderation queues, but I made sure they were rescued, and ever since I’ve had no deliverability issues sending to Google, some local ISPs, and even Microsoft (which seems crazy, as I never got a mail from my domain to show up in Outlook when I was relaying through Google).
I can only speak for my own experience, of course. But that is what I experienced.
Doing things perfectly and building up "reputation" helps a lot.
The easiest to work with have been Microsoft and Yahoo. I still haven't found a way to whitelist our IP on centurylink.net, charter.net and att.com (please let me know if you have any ideas)
Some links that might be of help to others:
[1] https://sendersupport.olc.protection.outlook.com/snds/data.a...
[2] https://io.help.yahoo.com/contact/index?page=confirmation&lo...
[3] https://postmaster.google.com/u/0/dashboards#st=userReported...
[4] https://support.microsoft.com/en-us/supportrequestform/8ad56...
The result would be a screen or two of auditable gobbledygook that took a week or so to write. Somewhere in there, there'd be a pointer to an EC2 or ECS image, among other things.
It'd be a learning experience, and very tied to AWS. I wonder if someone else already did this.