I like using thunderbird to have all my emails in the same place, in a unified inbox. This doesn't allow me to access my inbox on my phone etc though, so I'm looking for a FOSS way to solve this problem.
My idea would be to selfhost a website, like a webmail site, that has the functionality of connecting to different mail servers and unifying the inbox to get all my mail in the same place. Should be accessible by android phones and iPads.
Is there a better way to do this? Maybe with nextcloud? If anyone has an idea, let me know.
You understand that web servers (listening on a web server port) and mail servers (listening on one or more mail server ports, possibly on the same computer) are entirely different technologies?
They're just protocols. There's nothing preventing a program from interacting with both. Webmail isn't some mystical art no one's ever thought of before.
It's just a computer (or program, depending on context). It can do whatever you want it to.
If I want to write/modify a mail server that watches video feeds from 6 different beaches and only bothers accepting mail when beaches 2, 3 and 5 are empty and beaches 1, 4, and 6 have 500 people, nothing is stopping me. It's stupid and a waste of time, but it's a computer. It can run arbitrary code.
That's ignoring that if you read what he wants, it would be a client to the actual recipient mail server and only needs to actually serve the web interface so that he can access his email from various browsers.
Doesn't look like "a lot" to me. 15 years and going strong. The first page of google results for "how to set up a mail server" all include webmail, which would be both a web and a mail server.