NAME
GMail::IMAPD - An IMAP4 gateway to Google's webmail service
SYNOPSIS
# Start an IMAP-to-Gmail daemon on port 1143
use GMail::IMAPD;
my $daemon=GMail::IMAPD->new(LocalPort=>1143,
LogFile=>'gmail_imapd.log',
Debug=>1);
$daemon->run();
# Or if you prefer to use your own server socket,
# you can do something like:
my $i2g=GMail::IMAPD->new(LogFile=>'imapd.log');
for(;;){
my $s=someserver();
$i2g->procimap($s);
}
DESCRIPTION
Using the excellent Mail::Webmail::Gmail module, this module allows users to access a Gmail account with an IMAP client.
METHODS
- new ( [ARGS] )
-
Creates a new object. Accepts arguments in key => value form. Valid arguments are:
LocalAddr Local host bind address LocalPort Local bind port Detach Boolean to run in background. Default = 1 LogFile Path to log file Debug 1 = extra information, 2 = raw socket data
- procimap ( $socket_handle )
-
Directly pass a handle to the module to process IMAP commands.
NOTES
The IMAP and Gmail models differ. How GMail::IMAPD translates these differences is mostly intuitive. For instance, folders of course translate to labels. You can even have subfolders which translate to label names such as 'Work/NewProject'. Some translations that aren't as intuitive are shown in the table below:
Copy message to folder -> Add label to message
Move message from Inbox to folder -> Add label to message and archive
Move message to Inbox -> Remove label and unarchive
Delete message in Inbox -> Archive message
Delete message in folder -> Remove message label
Delete message in Trash -> Permanently delete message
Messages from other IMAP accounts can be appended to the Gmail INBOX, and INBOX only. The module achieves this by emailing the message to the Gmail account. Thus, the append procedure may be slow and the message will initially be marked unread.
GMail::IMAPD is not fully IMAP4 compliant and has just enough functionality to get by. It has been tested with Firefox, Outlook, Outlook Express, and mail2web.com.
CAVEATS
The IMAP client is automatically subscribed to all folders/labels. Unsubscribe has no effect. This is to eliminate any need for persistent server side data at the moment.
Once a message has been moved to Trash, it cannot be un-Trashed with the IMAP client. This functionality might be missing in the Mail::Webmail::Gmail module or I'm not sure how to do it with the module.
Access to large folders is slow. To fetch simple header information requested by most IMAP clients (FLAGS, INTERNALDATE, etc) requires GMail::IMAPD to download the entire message. Persistent message caching will help and is on the todo list.
To work, GMail::IMAPD currently bundles and uses patched versions of UserAgent and Mail::Webmail::Gmail. One line of UserAgent was changed to forward cookies to Gmail. And, only a patched version of Mail::Webmail::Gmail from the author's website works with the current version of Gmail. Future versions of GMail::IMAPD will remove these patched modules when the actual modules are updated. For more information on this topic, see http://code.mincus.com/?p=2.
BUGS
If a message is replied-to via the gmail web interface, and the reply is discarded, the message becomes unavaible to interfaces such as Mail::Webmail::Gmail. I believe this is a Google bug.
PREREQUISITES
LWP
Crypt::SSLeay
TODO
- Better error handling
- Persistently cached messages, perhaps with DBI
- IMAPS support
- A contacts folder, perhaps containing messages with xml and vcf attachments
- Copy from other IMAP accounts to any Gmail folder
- Interface with Mail::Webmail::Yahoo ?
CREDITS
I'd like to thank Allen Holman (mincus) for the Mail::Webmail::Gmail module. His module greatly accelerated the development of GMail::IMAPD.
AUTHOR
Kurt Schellpeper <krs - gmail - com>
COPYRIGHT
Copyright 2005 Kurt Schellpeper. All rights reserved.
This library is a free software. You can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 642:
You forgot a '=back' before '=head1'