move the complete logic into lumail.lua

All this can also be achieved with a few lines in lumail.lua. This is
also still fast when I open folders with several thousand emails at once