Local IMAP Mailbox in Nextcloud

Hello everyone,
I am looking for a way to save my mailbox in Nextcloud. So in principle not a complete mail server but simply a local IMAP mailbox where my mails are stored. I would then like to access this IMAP mailbox with the Nextcloud APP and also from my APP on the smartphone.
In the Nextcloud Mail APP I can only integrate IMAP mailboxes from elsewhere, providers etc. as far as I can see.
Is there such a possibility in Nextcloud? Does anyone have any tips?
If it is not possible, does anyone have a tip if there is such a thing for maybe for docker? I only ever find complete mail server setups, but I only need a IMAP mailbox. I still want to do SMTP via the provider.

Many greetings

Nextcloud doesn’t ship an integrated mail server, it only acts a client.

I’m looking for a way to have local “archive” mailbox for long time already but didn’t find a good way to host it locally so far. good and more or less easy mail hosting projects exist like mailcow but I never find a good tutorial for IMAP-only solution - every article I find so far was about full blown mail server which is nothing you want to host yourself…

Dovecot in combination with fetchmail, getmail or Iimapsync maybe? Or if it should be a “real” mail archive, maybe Mail Piler?

Or maybe a more light weight “full-blown” mail solution like Stalwart or Maddy or even a heavy one like Mailcow, and then only use the IMAP part in combination with IMAP Sync (which is already built into Mailcow).

I’m actually running my own mail server with Mailcow, but I’m running it on a VPS with a public IP address. In theory you could also host it at home, even with a dynamic IP address, as long as you don’t send email directly from that IP address: Relayhosts - mailcow: dockerized documentation

Thank you for your answers. I
I had already tried Dovecot but somehow couldn’t get it right. I’ll try it again and try the applications mentioned.
Mailcow would be interesting, but I’m currently having trouble getting it to work in my environment.
Maybe I just trust my mail provider, I have to rethink this all. It would simply be coolest if Nextcloud had already had an integrated fertie APP.