Unfortuantely I lost mails on my Desktop and I'm now trying to restore them from my phone. k9-mail shows them all, but I can't find an mbox file or something similar to reimport them into Thundebird.
Does anyone know where exactly k9-mail stores its local mails?
K9 stores mails with its own app data, so you cannot access them without root except through the app. However, you can indirectly get hold on that creating an ADB backup (without password!) and converting that into a tar archive:
adb backup -f k9mail.ab com.fsck.k9 ab2tar k9mail.ab
ab2tar is a small helper script you can find in the
tools/ directory of my little program Adebar (free, open-source; based on Bash and ADB). Alternative approaches for this conversion can also be found at XDA: What is an android adb backup?.
That done, extract the tarball and navigate into its
apps/com.fsck.k9/db/ directory. Here you will find one or more
.db files (one per mail account), which are SQLite files you can explore with apps like SQLiteman or SQLiteBrowser.
Mail headers and contents are spread across multiple tables and columns, so I cannot offer you an easy way to convert them into e.g. mbox format. On a "quick duck" (a search with DuckDuckGo) I found that question asked multiple times xe2x80x93 but the closest and most precise answer was "you could to that in Python" (of course, without instructions). Still, as requested by you, the first steps as answer: At least you can browse your mails that way using a proper SQLite browser ;)