<< February, 2019 >>
SMTWTFS
12
3456789
10111213141516
17181920212223
2425262728
Related Links
Search Blog

Categories
Archives
Photo Albums
RSS

Powered by
BlogCFM v1.1

24 January 2007

Migrating/Importing IMAP email to Gmail

About a month ago, I started using Google to host my domain's email (ie, webworksllc.com).  They host your domain email for free, using the same gmail interface that everyone loves.

The problem is, it's not super easy to migrate email from your old account to google.

There is a tool called the Gmail Loader (GML) that can handle all kinds of mail formats for mail stored on your desktop.  For example, if you use Thunderbird or Netscape to download your email via POP3, it stores that mail in files called "mbox" files, and GML can handle those.

If you're using Outlook, your mail is stored in special files called PST files, and you'll have to use a utility called "ReadPST" to convert them to mbox format files before GML can load them into google.

But if you're using webmail - or if you're like me and you use IMAP to store your email, then the mail is not stored on your local desktop.

One option - if you're using Thunderbird - is to copy your entire account - all of the folders - to your Local Folders.  This causes thunderbird to download *ALL* of the mail and store it locally in mbox files.  You can then use Gmail Loader.  Another option would be to ask your provider to zip your entire domain's mail files and send them to you - AFTER you go through and do your domain and account setup on google.  Then you can use gmail on those files (probably maildir formatted files, which Gmail Loader also supports)

But if you're running your own server, and you're using qmail - there's an easier way.  I created a little script called "sendtogmail.sh".

This only works AFTER you've set up google mail for your domain completely, set up the accounts, and changed the DNS.  You must also have configured qmail to no longer think it accepts mail for your domain - by removing it from /var/qmail/control/rcpthosts

I wrote a little script called sendtogmail.sh and this is what it looks like:

#!/bin/bash
CNT=0
for X in 1*
do
        cat $X | /var/qmail/bin/qmail-inject -A -f rick@webworksllc.com rick@webworksllc.com
        CNT=$((CNT+1))
        rm -f $X
        echo $CNT
done

There's probably a better way to do it, but I put this script into /usr/local/bin and permed it executable.  Then I just change into each directory where mail is stored, and run it.  It uses qmail-inject to inject the original mail file back into the mail queue.  The -A option causes it to only use the recipient specified in the command line, and the -f option specifies the envelope sender (don't worry, it won't have any affect on the "From" of the message itself.  After each message, it outputs a current count, and then removes the message (which is unnecessary, really)

It works quite quickly, because qmail is VERY good at sending mail!  It's *MUCH* faster than GML too, which seemed to take about 3-5 seconds per message, and I was able to do thousands of messages in only a few minutes.

 

Posted by rickroot at 8:22 AM | Link | 6 comments
Subscription Options

You are not logged in, so your subscription status for this entry is unknown. You can login or register here.

Re: Migrating/Importing IMAP email to Gmail
Can you fix the timer on "I LIKE YOU" guy?? Our time now is 7:25AM it is off by 3 hours...Thanks!
Posted by ashley on January 25, 2007 at 4:41 AM

Re: Migrating/Importing IMAP email to Gmail
The timer is not broken. It doesn't know or care what time zone you're are in.
Posted by rickroot on January 25, 2007 at 7:49 AM

Re: Migrating/Importing IMAP email to Gmail
This doesn't seem to work as it suggests for me. I go into each user's Maildir folder and then venture into ./cur, ./new and perform the script you provide with their email address instead of yours above. Qmail keeps complaining that the Delivered-To is already in place.

Am i supposed to strip these lines out or something?
Posted by Michael on February 22, 2007 at 6:56 PM

Re: Migrating/Importing IMAP email to Gmail
Ignore my previous comment.

You should mention to remove the domain from the /var/qmail/control/virtualdomains file as well as rcpthosts then do a /var/qmail/qmailctl reload before executing the script.
Posted by Michael on February 22, 2007 at 7:25 PM

Re: Migrating/Importing IMAP email to Gmail
Good point! With qmail, I'm never ENTIRELY sure which files are used for what, but your'e right, when I did this I removed the domain from BOTH files.
Posted by rickroot on February 23, 2007 at 3:16 AM

Re: Migrating/Importing IMAP email to Gmail
i have created a blog with the name bluekin.com but i am not able to access it so please provoid an other oppertunity to creat an other blog
Posted by Sunil Kumar on July 21, 2007 at 9:31 AM

Post a comment (login required)