This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new!


Import mail into Gmail with the Gmail Loader

By Joe 'Zonker' Brockmeier on March 19, 2007 (7:00:00 AM)

Share    Print    Comments   

So, you've turned your back on traditional mail clients and get your mail fix via Gmail these days. The only problem is getting to all those old message that are stuck in your old email client. One way to stuff that old mail into your shiny and capacious Gmail account is to use Mark Lyon's Gmail Loader.

GML is GPLed and written in Python, and available for Linux, Mac OS X, and Windows. Most popular Linux distros install Python by default. You'll also need the Python Megawidgets, which may not be installed by default. On Ubuntu and Debian, you can just grab the python-pmw package:

apt-get install python-pmw

After installing that package, download the most recent version of GML and uncompress it in the directory where you'd like it to live. You should have three files: the Python script, a COPYING file, and the README file. You can open the README if you would like to get an overview of the utility. After that, just start GML by running:


GML only has a few fields you'll need to tweak before you can get started. The first, the SMTP server, defaults to one of Google's SMTP servers. If, when you first run GML, it doesn't seem to work, you might want to change the SMTP server from the default to one of the Gmail servers listed on this page instead. For instance, I switched it from to after my first attempt to load messages failed, and had better luck.

Gmail Loader interface
Gmail Loader interface - click to enlarge

You can also send messages through another SMTP server if your ISP blocks port 25. To do that, replace the Google SMTP server with your ISP's, and add the authentication information if necessary.

Next, find the mailbox that you want to upload by clicking Find and navigating to the file or directory you want to upload. Then choose the mailbox type and message type, and provide the Gmail account that you'd like to upload mail to. The GML interface provides a few hints as to the type of mailbox you might have depending on the client you use.

After that, click the Send to Gmail button and hang loose while the messages are copied to the server. The application has a two-second timeout between messages, so it will take a while if it's copying a large amount of mail. In that case, you might want to just start the job off before you step away from the computer for the day and check in again the next morning.

To test GML, I uploaded about 1,300 messages from one mbox-formatted mailbox to a Gmail account. It took several hours. I didn't see any problems with the mail after upload. Gmail seemed to get the conversation threads right after mail was uploaded, and the original message dates were preserved. For some reason, Gmail tagged quite a few imported messages as spam, but it's easy to herd the strays back into your inbox.

GML supports mbox, maildir, MH, and a few other mailbox formats. You also have two choices for mbox: normal or less strict. The latter is designed for mail saved by clients that don't necessarily follow the mbox format precisely. The docs don't say which clients, exactly, and I've had no problem with the standard mbox option. If you have trouble importing mail in mbox format using the normal mode, try less strict instead.

In addition to GML, Lyon has a suite of additional utilities that interact with Gmail. A few of the utilities seem to be a bit outdated, and several are Windows-centric. The most recent release of GML itself is a bit long in the tooth, though it works just fine; 0.5 was released in 2004 according to the README, but according to the site 0.6 is in development.

For folks who don't go for GUI utilities, Lyon still offers GML's 0.4 release, which is command-line only. You might also want to look at the Gmail Loader Enhanced, which includes a fix that makes GML resend emails if the SMTP connection is reset during the upload.

GML is a simple utility, and not one that you'll need every day, but if you want a simple way to archive all those pre-Gmail messages, then it's just the tool for the job.

Share    Print    Comments   


on Import mail into Gmail with the Gmail Loader

Note: Comments are owned by the poster. We are not responsible for their content.


Posted by: Anonymous Coward on March 19, 2007 05:24 PM
Another way to stuff mailboxes is to use 'syncmail' (see <a href="" title=""></a>) which synchronises multiple mailboxes one- or twoway. This enables you to work with Gmail on the road while using your local MTA at home.


Does GMail do IMAP? Yes or No?

Posted by: Anonymous Coward on March 19, 2007 07:34 PM
<a href="" title=""><nobr>e<wbr></nobr> r=10339</a>
"Does Gmail support IMAP?
Gmail doesn't currently support IMAP access. As part of our ongoing commitment to give our users easy access to their email, we have introduced POP access. We look forward to announcing other new features as they become available."

So - For migrating email between different distro installs and experiments...

I find that IMAP server is the way to go.
If you ISP or other Domain Hosting provider does IMAP ( <a href="" title=""></a> is an example), then just do IMAP out of the box, you can migrate IMAP email in an instant (POP3 migration is like pulling teeth, sometimes...)!

OF course - by using THUNDERBIRD, you can put address books and calandering into storage in your IMAP server, instead of using LDAP (the ISPs and Domain Hosts don't do LDAP, so this IMAP SyncKolab stuff is your only viable option).
<a href="" title=""><nobr>4<wbr></nobr> /07/1726220&from=rss</a>
"Turn Thunderbird into a collaboration tool...
By default, Thunderbird doesn't have a calendar, and it lacks the ability to synchronise data between multiple clients. However, the Calendar plugin combined with the SyncKolab extension can fill the void. You also need an IMAP account, which SyncKolab uses to synchronise the contacts and calendar data. You can either use a local Kolab server or an IMAP email account; the latter option is probably easier".

Of course - if GMAIL could do IMAP, then they should also do this... and use the GOOGLE summer of code to make sure that for small business and individual users that this SyncKolab stuff worked and was scalable as well to larger enterprises.

Hey GOOGLE - are you listening?

PS - And with the new Ubuntu migration tool...
<a href="" title=""><nobr>0<wbr></nobr> 7-03-06-027-26-RV-DB</a><nobr> <wbr></nobr>... then we can all switch to the desktop of choice in a minute... good-bye complicated lock-ins to Microsoft or anyone else... freedom of choice then becomes as easy as trading a car in for the new one that you really want.


You might be interested in this

Posted by: Administrator on March 19, 2007 08:20 PM
Dear GMail User,
For more information, please visit


Re:You might be interested in this - Creepy!!!

Posted by: Anonymous Coward on March 19, 2007 09:07 PM
You mean this link...
<a href="" title=""></a>

Yea, that is creepy.

Freedom to get away from this mistake is a must... so - IMAP for GMAIL is a must as well, as how do you get away from Gmail, if you find yourself trapped by it (or any other email for that matter that is web browser based)?

But, to be able to get into, and then out of, an email situation is a pain in the butt.

My suggestion is to get your own Domain Name, then you are not having to migrate as well all your customers, friends, and family to a new email address as well. So - you don't depend on GMail, Yahoo Mail, Comcast email, etc...or POP3... as with IMAP, and your own domain name, you can be more mobile with where you want your email to be...

Choice and Freedom... that is what we really need.



Posted by: Administrator on March 23, 2007 08:29 PM
Very good. I tried some other scripts before, but none of them worked properly! Thanks!


Import mail into Gmail with the Gmail Loader

Posted by: Anonymous [ip:] on September 19, 2007 08:04 PM
1) Well, after a few dozens of messages Google starts to complain, that I'm not authorized to use their smtp server. Sometimes it accepts some messages after and between error messages.

2) GMail preserves the original dates inside the messages, but shows and sorts according to the dates *it* received the messages.


Gmail Loader is NOT uploading

Posted by: Anonymous [ip:] on September 29, 2007 04:32 PM
i am using FC7. i ran using python, and entered all the necessary data, as instructed. When i click "Send to Gmail". i get a prompt saying "file opened successfully" , and "Done. 0 Success...", so, the message was not uploaded to gmail at all.

what is wrong? please help


This story has been archived. Comments can no longer be posted.

Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya