Importing mail into Gmail

May 18, 2007 at 5:44 pm 2 comments

To import mail into Gmail, the existing Google GMail Loader could be used. This solution works, but since it sends the messages using an SMTP, all dates are reset to the current date. For me, this is very annoying so I searched another solution.
I used the Dovecot IMAP server with secure POP3 access to import my existing mail (from Mozilla Thunderbird, i.e. mbox format) into Gmail. This way, the dates are preserved.

Using Ubuntu Feisty, this is a very simple process:

sudo apt-get install dovecot-imapd dovecot-pop3d

This installs the necessary Dovecot IMAP and POP3 server (version 1.0.rc17). Mails are kept in the mbox file /var/mail/username (got the is info using the script from Dovecot’s wiki).

For Dovecot to work, a configuration file needs to be altered:

sudo pico /etc/dovecot/dovecot.conf

Uncomment ‘protocols’, add pop3 (normal version port 110) and/or pop3s (secure version, port 995):

protocols = pop3 pop3s

The normal pop3 is good in this case, as I tested some things using telnet and the USER/PASS/STAT/RETR commands.

Next, copy the Mozilla Thunderbird mbox file (called ‘Inbox’) to /var/mail. I actually added another user on my Ubuntu system called ‘mboxbackup’, since Gmail will add the existing username in the header of every mail using ‘X-Gmail-Fetch-Info’. Rename the ‘Inbox’ file and chown the file to the newly created user.

Eventually, one could test the newly created pop server from another machine using e.g. telnet. You should get something like this:

$ telnet <ip-address> 110
Trying <ip-address>...
Connected to <ip-address>.
Escape character is '^]'.
+OK Dovecot ready.
USER mboxbackup
+OK
PASS <password>
+OK Logged in.
STAT
+OK 1007 84278254
RETR 1
+OK 3859 octets
X-Account-Key: account2
<snip>

Only 1007 mails are on my POP3 server now, since I broke up my existing Mozilla Thunderbird mbox file to test (very easy, just create a folder in Thunderbird, copy or move the messages into it and off you go!). Gmail shouldn’t have problems importing any amount of mails since maximum 200 messages are fetched at once.

I restarted Dovecot (I used ‘killall dovecot’ to stop).

In Gmail, go to ‘Settings’ –> ‘Accounts’ and choose ‘Add another mail account’. As your email address, anything could be entered. In the next step, enter the username and password, choose ‘Always use a secure connection (SSL) when retrieving mail’, enter ‘995‘ as port and eventually choose a label.

Voila! Importing should start, 200 mails will be pulled every time. Dates should be kept as the original ones.

Note that e.g. 10000 imported mails will probably not result in 10000 mails in your Gmail inbox, since Gmail tries to make threads of replies and answers automatically. Check your spam folder too.

Advertisements

Entry filed under: Gmail, Ubuntu Feisty.

Unreal Tournament GOTY on Ubuntu Feisty

2 Comments Add your own

  • 1. TrueCrypt and TCGINA « Tech.  |  May 31, 2007 at 1:32 am

    […] threat. Apart from the hardware, all my personal documents like pictures, e-mail (Thunderbird, as I used to use) containing passwords, FileZilla.xml file containing passwords and so much other valuable […]

    Reply
  • 2. www.mysqlindex.com  |  May 25, 2015 at 10:30 am

    I know this site offers quality based posts and extra stuff,
    is there any other web page which offers these kinds
    of information in quality?

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

May 2007
M T W T F S S
    Nov »
 123456
78910111213
14151617181920
21222324252627
28293031  

Most Recent Posts


%d bloggers like this: