IMAP emails send via cellular data but not via WIFI

I seem to have this same problem - emails being sent only on cellular, not on wifi - and the problem seems to affect emails sent from a Microsoft account, a Gmail account, and a Mailfence account.

I don’t know what to do - except (as mentioned in this post) to uninstall and then reinstall from F-droid (after using K-9 to export its settings). And when I tried that . . F-Droid crashed. So then I installed K-9 from the Google Store. And when I tried to import settings I am told that the import of some settings failed. Seemingly the settings for my Gmail account were not imported. I recreated that account. And now everything seems to work, though I could really have done without all of this. So: here we have an eventual fix.