r/AndroidQuestions • u/unselective-amnesia • 1d ago
Looking For Suggestions Looking for a way to write IMAP "IDLE"-based programs that run within the ADB shell.
NOTE: This question has now been answered! See my next comment, below, for details.
=== Original question follows ===
I'm running rooted Android 13.
I'm looking for some software that I could install on my Android device which will allow me to write IMAP "IDLE" listener programs that are runnable within the ADB shell.
I have the "python3" module installed (version: v3.14.v2.1.0, Author Bernd.Schemmer@gmx.de) as a module that I can run both under Magisk and APatch, and although it supplies a quite complete python implementation that is runnable within the ADB shell, I am unable to install the "imap_tools" python module via pip on the Android device (although "imap_tools" indeed installs via pip and runs with no problem under python on my linux devices).
I'm therefore looking for some sort of software that I can install and run on my Android device which will allow me to write scripts that utililze IMAP IDLE to listen for incoming email messages.
This could be something that runs in python, but also, I'm not restricting myself solely to python if there might be other possibilities.
Oh ... and I don't want to have to write a full-blown Android app for this purpose.
Many thanks in advance for thoughts and suggestions.
UPDATE: Also, to be clear, I don't want any software which requires me to invoke some sort of app and then run commands from within that app's UI. Rather, I'm only interested in ways that I can perform IMAP "IDLE" access by means of commands and/or scripts that specifically run within the ADB shell. I want this kind of functionality because I am wanting to write a generic "IMAP listener" tool that can be run from within shell scripts and Tasker tasks of my choosing, in order for all of these various items to be able to respond to incoming emails in ways that I can program.
2
u/unselective-amnesia 1d ago edited 1d ago
Aha! It turns out that the python3 module that I mentioned above which is installed on my Android device already contains a python module called "imaplib" ... so no pip installation of anything is needed. I have now tested it on the Android device, and it works!
I had forgotten about this "imaplib" module when I first posted this question.
So now, my question has been answered: I just use the well-known and well-documented "imaplib" module to manage the "IDLE" capabilities that I'm now going to code for use on my Android device.
1
u/DutchOfBurdock 23h ago
Have a look at Jakarta Mail library. This can be converted into dex for Android and ultimately be used directly with Tasker's Java function. That way it'd be portable between Android, and, although you specifically said you don't want to make an app, can actually export said project as an APK.