- For incoming mail, on your server run a mail retrieval agent like fetchmail to fetch mail from the externally hosted mailbox into a maildir on your server.
- To serve that maildir to your clients, on your server run a mail delivery agent like the IMAP server Dovecot.
- To accept outgoing mail from your clients, on your server run something like Postfix with a
relayhost
configured with the details of your externally hosted SMTP server.
There’s nothing unusual or tricky about any of this arrangement.
Anyone can now provide that service. Why pay OpenAI when you can pay a different service who is cheaper or provides a service more aligned with your needs or ethics or legal requirements?