delete old emails if necessary, turn off convo view (Settings > General) since this lumps everything together. (note, you can do things like “before:2014/4/29?)
Use getmail to pull all emails as mbox or Maildir format from your old email account. I initially did maildir hence why below I convert them to mbox for thunderbird.
I configured like this for pulling from our corporate exchange server:
[retriever] type = SimpleIMAPSSLRetriever server = exchange.herpderp.net username = [email protected] password = secret mailboxes = ("Inbox", "Sent Items") [destination] type = Maildir path = /home/merry0/mail/ [options] verbose = 2 message_log = ~/.getmail/log # do not alter messages delivered_to = false received = false
My email’s from exchange had a pretty dire problem. For whatever reason (google didn’t tell me much on this), prepended to every address in every to field (on every single email), was ‘*=SMTP:*’ so a to line would look like “*to:=SMTP:[email protected]*”.
Yeah this was super annoying. To fix it, once everything was in maildir format, I ran this fancy commamd in the directory holding all the emails:
grep -rl '=SMTP:' * | xargs sed -i 's/=SMTP://g'
convert to mbox script (only if your email is in maildir format. if you are already in mbox, you’re fine) This script is nice and simple, note that you may need to do a
apt-get install python-mailbox.
using thunderbird, add the ImportExportTools addon, create a Unix Movemail account and right click on it, then, ImportExportTools > Import mbox file
- Enable IMAP in your gmail settings. Then, add this account to Thunderbird. Standard IMAP SSL settings google uses (e.g. imap.gmail.com) apply here. They have a guide on this.
Select the emails you want from the mbox based account to be moved to google. First I did the emails sent by myself. Just right click > copy > Your Gmail Account > [Gmail]/Sent Mail. Then, I did the rest to [Gmail]/All Mail
You may want to dump all your non-sent mail to a label instead of All Mail in case you have a ton of emails and want to track which ones you are migrating. In my case, the connection dropped somehow and Thunderbird didn’t just try again, it just kinda stopped.
When you do this, the messages are not going to your inbox automatically. This means once your messages are moved over, to ensure they exist in your inbox, select all the messages in your “*migration*” label and select Move to > Inbox. These messages will still keep the “*migration*” label but will also exist in your inbox!
Finally, you will have to re-apply your filters by searching again for emails matching that filter. Go through each filter, hit edit, and re-search for matching emails. Then just do the Continue > Update Filter to ensure the filter applies to the newly added emails.