Torsten Curdt’s weblog

Gmail Import

Before I was using Gmail only for private emails – now I am using it for all my daily messages. Again I had to import some of my existing mails. Bertrand has already blogged some excellent instructions on how to do that. Some things I did differently though.

For one I wanted the subject line change to be as little disturbing as possible. (Gmail so needs an overhaul of its filter facilities!!) So I just added an “_” to then end of the subject and filtered on that.

sed s"/^Subject: \(.*\)$/Subject: \1 _/" < inbox.mbox > inbox.mbox.marked

I also modified the GML script to save the state of the import. So you can hit Ctrl-C at any stage of the import and continue later on. It now also writes out an error mbox file with message that could not be imported. (I had a few that the python library failed to parse). For the mail server to use check the Gmail MX record.

dig mx gmail.com

So I used…

python ngml.py mbox inbox.mbox.marked account@gmail.com gsmtp183.google.com.

You can get hold of the modified GML script here.

  • Octavi Fors
    Does this ngml.py script fix the import date problem in Gmail message list webpage (Gmail is not able to display the actual date of reception/sending and substitutes this by the import date)?

    If not, any ideas how this could be workarounded (apart from Gmail people fix this, of course)?
  • weird. Gmail is hosting my domain (yet another beta service from google)... so maybe that's why it works differently.
  • I tried that, too ...but did not work for me
  • Instead of modifying the subject, change your gmail address thusly:

    say I'm uploading my oldSent folder I'd use: account+oldSent@gmail.com

    Then I'd build a filter for To: account+oldSent@gmail.com
blog comments powered by Disqus