K-9 Mail Clues

icebike

Well-known member
Apr 8, 2010
1,726
115
0
Visit site
I'm posting this here on the chance Google Spiders will find it, and maybe it will be useful for others.

First: I love K9 Mail, AKA K-9 from the Market: https://forums.androidcentral.com/e...re/apps/details?id=com.fsck.k9&token=WxpAG5iL
Its probably the single most powerful email client for Android.

Note: for your principal Gmail Account, I recommend using the Stock Gmail App. But many of us have secondary Gmail accounts that we don't want to add as an Account in the Gmail control panel, (that causes confusion and can lead to merging contact lists and general chaos and gnashing of teeth). K-9 Mail works great for handling many different email accounts from many different providers, and it can handle Gmail perfectly.​

Because of its power, it can sometimes trigger problems that will be hard to diagnose. One of these is the Dreaded Gmail "Too many simultaneous connections" warning when you have K-9 handle your Gmail Account.

You can get the "too many connections warning when your Gmail account is set to IMAP, (which is the only way to go IMHO) and when you have multiple computers monitoring the account. Google allows 16 connections, as of this writing. The worst offender of is Thunderbird, which defaults to 5 connections. So Thunderbird, set up using the defaults on two machines takes 2/3's of the allowed connections.

Then if you add in a few portable devices, your current Android phone, Your Prior Android phone kept kicking around on your desk, A Tablet (or two), you can chew up quite a few more connections. Open up Gmail in a web browser, and that's at least one more connection.

But, there is also some evidence that simply roaming out of the reach of one cell tower to another will (at least temporarily) cause duplicate connections from the same device.

How does this affect K-9 Mail?

Well each FOLDER you set to "PUSH" ties up another connection, because K-9 uses one connection for each folder that is set to sync by Push. But Google counts all of those individual Folder Push connections against the account. So if you have an elaborate Gmail Folder structure, and you take the easy way out and set them all to Push, you can tie up a boatload of connections on the email account. Replicate that K-9 setup in another device, and you can see where you might be pushing the limit of 16 connections.

Is K-9 mail doing it wrong? I think it is, because I run my own mail server on linux, and I can see other Email clients using a single IMAP IdleD connection to monitor the entire account, without the need of one-per-folder. IMAP IdleD, which runs in a mail server, is designed to tell a mail client that something has changed on this account. The mail client is then supposed to Poll the account, and check for new mail. However you can also get notifications by each folder, and this is the expensive way to do it. (it was intended to be used only for shared mail folders monitored by a bunch of different users).​

Anyway back to the Story.

K-9 controls connections based on which folders are set to Push. So you only REALLY need to set those folders that are important to push, and leave all the others to be Polled. Then set your Poll time to something fairly long, like 30 minutes, or to save battery, maybe even two hours. Other folders you don't even have to check at all.

All of this is controlled by the k-9 concept of Classes. Each folder has three CLASSes assigned to it.
  • VIEW Class, controls which folders show in your list of folders.
  • SYNC Class controls if the folder is to be kept in Sync between your Android device and the server.
  • PUSH Class controls if a folder should be monitored for any activity at all.

To minimize your use of IMAP connections, you want to keep as FEW folders in PUSH Class as possible.

Recommendation:
PUSH CLASS 1, should be assigned ONLY to your high priority folder folders where you need Instant Notification.
The rest can be set to PUSH Class NONE. (There is never a reason to use PUSH Class 2)

(Push won't work on POP accounts. These you have to Poll)

SYNC Class 1 should be assigned to those folders you want updated only when K-9 Polls the server automatically. (Polling a Push folder is redundant, but not harmful)
SYNC Class 2 can be assigned to folders you don't always need synced. This allows you to temporarily tell K-9 to only poll 1st class folders if you are in a poor or expensive bandwidth area such as traveling overseas. Realistically, you don't need to assign Sync Class 2 at all.
SYNC Class None will not be automatically polled. Trash or Storage only folders are a good candidate for this. You can still enter the folder and yank down on the display to trigger the syncing of this folder if you suddenly decide you need something in there. (This is called a manual poll).

DISPLAY Class 1 Folders are always shown. Simplify your life and only mark ESSENTIAL folders as display class 1.
DISPLAY Class 2 folders can selectively be displayed. You control this while looking at the folder list, tapping the three dots menu, and select which folders to show.
DISPLAY Class NONE, well, what can I say. You can still these if you select three dots menu and say show all folders.

So, if you start getting the dreaded too many connections error from Google Gmail, FIRST point the finger of Blame to Thunderbird, but then look to your K-9 mail if you use it, and reduce the number of folders you are handling with PUSH. There are a lot of folders besides the INBOX in a Gmail account, and if you let K-9 default to push for all of these you are going to exceed the connections count even when you have only one or two devices monitoring the account.

Note this also affects other IMAP servers as well. Your ISP may use IMAP, and if it is a big company they may have to limit Connections as well. There is really no reason to keep a connection open for a folder that is only updated once a week or something. Use Polling for those folders.

HTH
 

Forum statistics

Threads
943,156
Messages
6,917,554
Members
3,158,854
Latest member
WillyC