I think JMAP (the IMAP successor) is the best choice here. It was designed to be an open alternative to the proprietary APIs offered by Gmail and the like. It offers a JSON API that clients can talk to using HTTP. The JMAP website has some examples: https://jmap.io/crash-course.html
So it seems that a simple server that implements JMAP would be what the OP is looking for, perhaps https://github.com/stalwartlabs/mail-server (which also supports SMTP/IMAP for compatibility with other clients)?
Autofahrer nicht vergessen, bei uns haben sie gestern erst (zusammen mit den Freien Wählern) den Marktplatz in einen Parkplatz umgewidmet.
Die Konsequenzen dieser Politik können dann bei rentnerfahrenindinge@feddit.de bewundert werden.