In rebuilding our mail server last month, I added Courier’s IMAP server enabling us to keep mail on the server instead of always downloading it. You might want to do this if you access your email with multiple devices and you want to see all your emails regardless of whether you connect via Thunderbird, mobile phone or webmail.
This week I got around to “switching” my POP3-based email account to IMAP using the following steps with a few gotchas:
- For safety, I shutdown Qmail on the server while I performed this but depending on your mail load you might be able to keep it online
- As root, change to the vpopmail directory for your domain (in my case, /mail/domains/domain.com)
- Move your mail folder out of the way (mv username was_username)
- Now “delete” your user to remove all of the “stuff” in there (in my case, some folders created by sqwebmail and my DSPAM .qmail files): /mail/bin/vdeluser [email protected]
- Re-add yourself: /mail/bin/vadduser [email protected], and enter your password twice
- In Thunderbird, under account settings, disable your POP3 account by turning off automatic checking at startup and checking for mail every 10 minutes
- Add a new account, this time an IMAP account using your same server settings. Thanks to our fancy new setup, we support IMAP over SSL and SMTP/TLS for a completely encrypted and secure mail experience.
- Send yourself a test mail and verify you can retrieve it successfully
- If you have lots of POP3 folders, you’ll want to move them onto the server.
- TB will let you drag and drop folders from POP3 to IMAP accounts but there are a few caveats
- If you have nested folders, it seems to only copy the sub-folders if the top-level folder has at least one message in it. Some of my folders were merely holders like “clients” which then has a number of folders below it. If “clients” was empty, it didn’t seem to copy any sub-folders so put at least one message into the parent folder for the copy.
- It seems to timeout on really large folders. If you have big folders with lots of attachments, you may find it will timeout after awhile in which case you’ll need to shut down and restart. This could just be a condition of my server and network connection since I’ve only done it once.
- TB also has, under the “Message” menu, an option to “copy” or “move” messages which works equally well (if not better).
Now all of your POP3 email is on the server and your IMAP mirrors your POP3 setup.
- Unfortunately, Thunderbird appends your brand-new account to the very bottom of the folder pane. If you want it at the very top, you can click in Thunderbird to make it your default account. The default account always appears on top. If you want to change the order in any other way, close TB and edit your prefs.js file by hand.
- When looking in your prefs.js file, there are account1,account2,account,3 and so on. These are mapped to id1,id2,id3, etc. If you look for idX, you will be able to tell which account they refer to but be careful: there may not be a 1-to-1 mapping from accountX to idX. In my case, account7 referred to id6 and account10 referred to id8!
- Restart Thunderbird and your IMAP account should be up at the top or wherever you positioned it
At this point, your IMAP account should be in the same slot in Thunderbird’s folder list as your original POP3 account and it should have all of the same email.
I am keeping the POP version of the account around because periodically I will “back up” my server-side email from the IMAP into the POP3 account by using the “Copy to” function described above. If anyone understands in depth how offline mode works and what “subscribing” to a folder means, please let me know!