E-Mail and Chat are today more and more merging to Messaging.
Chat requires a server.
That could be an e-mail-server too, but there is no java android code for the poptastic protocol for chat over e-mail- servers as e,g, describe here:
bugzilla mozilla org/show_bug.cgi?id=1777771
Instead the use of simple to install and admin servers are requested:
the java code for that chat application is found here:
Can you integrate that chat app code into K9?
In any case: Chat servers for encrypted chat that cannot be installed, administered and maintained easily by each pupil in a school class or be run on a raspberry pi should be proofen very seriously to be part of the architecture of (y)our messaging future.