Wouldn't it be great if you could access your GMail account using your favourite email client from multiple computers, yet keep all of them synchronized? That's what you could do if they provided support for the IMAP protocol, but unfortunately they currently don't.
So yesterday I was wondering... would it be difficult to write an IMAP gateway for GMail? Sure it would but... guess what? It already exists! The GMail::IMAPD Perl module implements this functionality in a ready-to-use service. All you need to do is copy/paste the sample program in the manual page, execute it and you've got the gateway running.
Unfortunately, it's still quite incomplete as it only supports some mail clients and lacks some features — the documentation gives more details on this. I could get it to work with Apple Mail but was very slow overall (maybe because I have a lot of mail in my account) and had random problems. You might get better results though.
For your pleasure, it is now in pkgsrc as mail/p5-GMail-IMAPD alongside a patch to accomodate a change in GMail's login protocol. There is also the programmatic interface to the web service used by the former in mail/p5-Mail-Webmail-Gmail, but be aware that the former includes a somewhat obsolete copy of the latter due to non-official modifications.
Update (August 26th): I am not the author of the above mentioned Perl module and therefore I cannot provide support for it. Please read the manual page and, if it is not clear enough or if it does not work as you expect, ask the real author (Kurt Schellpeper) for further details. Anyway, to answer some of the questions posted:
To get this module to work, install it using CPAN or pkgsrc (recommended). Using the latter has the advantage that the module receives a fix for the login procedure. If you install it manually be sure to apply the required patch!
Then open up an editor and paste the example code in the module's manual synopsis section:
# Start an IMAP-to-Gmail daemon on port 1143Save the file as, e.g., gmail-imap.pl and execute it from a terminal using: perl gmail-imap.pl (/usr/pkg/bin/perl gmail-imapl.pl if you are using pkgsrc). Once running, configure your mail client to connect to localhost:1143 using IMAP v4. If it does not work, I'm sorry but you are on your own. (Again, contact the module's author.)
use GMail::IMAPD;
my $daemon=GMail::IMAPD->new(LocalPort=>1143,
LogFile=>'gmail_imapd.log',
Debug=>1);
$daemon->run();
Hope this helps.
12 comments:
They do implement pop3s (POP3 over SSL), on pop.gmail.com:995.
I know... and I used to use it, but it is not as comfortable as IMAP could be.
E.g. I tend to leave pending stuff into the inbox until I deal with it (which may be even months...); if this is downloaded into some machine, I can easily lose its track.
Well that could be usefull. I'm actualy use the forwarding functin of GMail to forward new emails to an other email client.
A short step by step manual could be usefull...
I got this to run using the example script with perl-5.8.6-24 on FC4; however, when connecting with ChatterEmail (a great IMAP client for the Treo smartphone) I get the following in the log:
cmd_LOGIN: gmail error: Error: Could not login with those credentials
Additionally, HTTP error: 200 OK
I've tried the username with and without the @gmail.com; the same information pasted in a browser logs in fine so I'm not just mistyping something.
I havn't tried another client (as Chatter is what I'd prefer to use it with); any ideas?
Jason: Are you using the pkgsrc package or the distribution straight from CPAN? The pkgsrc package has a bug fix for the login process; see the patch.
Yes, I grabbed the tarball from CPAN page; I installed the patch and can now authenticate without a problem. With Thunderbird on a PC, it connects and shows the folders ("Inbox", "All", "Spam", "Starred") but never shows a message list. With Chatter on the Treo, it shows "FolderList" for some time, then crashes the phone (not sure exactly what it's doing at this point). The log simply shows Connect and LOGIN with no other information.
I'll keep trying, thanks for your help so far -- this is very exciting, as the only major problem with Gmail is the lack of IMAP (and thus the lack of any real ability to use Gmail with a smartphone/BlackBerry/etc).
If anyone's willing to comment on the setup process (for Perl newbies like me) I'm sure more people besides me would appreciate it. I'm usually able to work through any error messages I get when trying new things like this, but Perl is uncharted territory!
I'm in need of direction, too -- is it just the code between SYNOPSIS and the two-commented-lines that we need to save and execute? I did that, can run it, but can't get Thunderbird to connect on localhost:1143. I also tried gmailusername and gmailusername@gmail.com to no avail. Am I forgetting something?
Disclaimer: I'm still very much a newbie, but here's what I've discovered so far. Your mileage may vary, etc, etc. (I'm using OS X 10.4.7)
1) Connect to CPAN by typing:
perl -MCPAN -e shell
2) Make sure the dependencies mentioned in the Makefile
3) Type:
install GMail::IMAPD
4) You're on your own from there :)
I've updated the post with answers to some of the questions raised here.
Hmmm this isn't working for me even with the patch:
http://rt.cpan.org/Public/Bug/Display.html?id=22058
anyone have any ideas?
I understand that gmail would prefer people to use their interface, but like I know if the imap option was available, i wouldn't consider leaving gmail. Gmail - enable imap :)
Post a Comment