Well done you guys!!
@3fazeac: Any chance you will share your code?
I will upload what I've written. Remember that it's just a couple of days work. Hopefully people can take this as a starting point and create a fully functional imap library.
The example program has several hard-coded string constants and limited error handling but it is short and simple and functional.
Apart from the b4a program, here are the other things you have to do to get things working:
1) get commons-net-3.3.jar off the internet (probably as a .zip file) and put the commons-net-3.3.jar in Programs-Files/AnywhereSoftware/Basic4Android/Libraries
2) get agraham's Threading 1.10 library, insert into the /Libraries folder too
3) in the b4a project, in the Libs tab, select JavaObject and Threading (and Core, of course)
4) in Project->Build Configurations, in the Conditional Symbols field, add Apache_Commons_Net
It's the same string as on line 9 of the b4a program
5) in the Project->Manifest Editor, insert permission.INTERNET and permission.ACCESS_NETWORK_STATE
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<supports-screens android:largeScreens="true"
etc
6) get your gmail account open in a browser and create a gmail folder called imaptest
7) copy some unimportant small emails into the imaptest gmail folder
8) edit the imap.b4a code and on about line 44 enter your gmail username and password
9) make sure that Layout1.bal is in the Files subdirectory
10) The output from the program is all to the log console so have access to that somehow. (I ran everything with the phone connected to the PC) I don't know how it would work with the simulator.
Good luck and share any tips.