Saturday, November 24, 2007

Popping GMail in the IMAP era

I've finally decided to start blogging after discussions with friends, and a sudden on rush of possible subjects. I decided to go with whatever Google provided based on generally good experinces with Gmail. After plowing into it I found out that their service, Blogger/Blogspot, (and not Gblogger or Googlelog as I might of expected) was both recommended by a friend and used by the L.A. Freenet to keep an 'out of band' status channel for it's users.

As part of a push to start using more 'Web 2.0' services, I recently decided to redirect one of my email forwarding addresses through GMail to take advantage of what seemed to be superior spam filtering. All seemed well till I noticed expected mail through the redirected address seemed to dry up. A little investigation showed that to my embarassment, GMail was already forwarding to the redirected address, had been for some time, and their mail servers had correctly noted that forwarding mail back to the address it was coming from was setting up a mail loop and simply let it set in the inbox rather than start looping the mail back and forth out of control. Of course I corrected things to not send gmail to the first redirected forwarding account.

Friends may already be aware that I normally ultimately download and sort out my email from my Los Angeles Freenet account using a Perl script I wrote using the Net::POP3 library, and actually read it with vi where I can generate summaries of mailing lists with various scripts I've written to speed things up. The perl script allows leaving the messages in the mailbox or removing them with download, getting a summary of message number and sizes, grabbing just the headers, deleting a range of messages, etc. I've told a few people, with tongue in cheek, that IMAP is simply a copout to avoid giving people shell accounts to manage their mail accounts. All this usually follows a preliminary scan and maybe some urgent responses with LAFNs web / email interface. This Perl script already had provision for popping my gmail account and it seemed a simple matter of scooping up the messages over the range of time the loop had existed. I've had the Gmail account for several years and never clear anything out of it. Logging in to the account currently shows about 3,000 messages. I was shocked when running my Perl script to only see 516 on check of mailbox size. Using a switch to download the headers and a few lines of the message body, I found these messages to be from the beginning of the account. I downloaded and ran another perl script from the Debian repositories, POP3browser, that produced the same results. This was not just me.

Digging around in the GMail help, I found that you needed to preface your user account with 'recent:' when loggin in to get the last 30 days of email. As an example, I have to log in to the POP server as 'recent:dallas.legan@gmail.com' to access the most recent mail. If you are detected to be using a Blackberry to access the account by POP, supposedly the last 30 days will be accessed automaticly. This leaves the messages after the first 516 messages and before the last 30 days in a state of limbo. I looked briefly over the POP RFC for POP Version 3 and didn't notice anything about 'recent:', 516, etc., so this is undoubtedly something brought on by necessity when never deleting messages for several years.

Whether it has anything to do with Google recently adding IMAP access to GMail accounts I don't know. Anyone having more information on this, feel free to contact me about it.

1 comment:

Rog said...

For the most part, I haven't had problems IMAPing.

The only "problems" I have are: (1) weird tags gmail makes in outgoing mail via Thunderbird, (2) my Nokia 770 taking a dump when I IMAP my 2+ GB email account.

Rog