How To Migrate Mailboxes Between IMAP Servers With IMAP TOOLS
How To Migrate Mailboxes Between IMAP Servers With IMAP TOOLSVersion 1.0 This guide explains how you can migrate mailboxes between IMAP servers with IMAP TOOLS. IMAP TOOLS is a collection of Perl scripts that allow you to do various tasks with IMAP servers and also POP3 servers. In this article I will focus on the scripts imapcopy.pl (copies messages and mailboxes from one IMAP server to another) and pop3toimap.pl (copies POP3 messages to an IMAP server). Both scripts support SSL. If you specify port 993 (995 for POP3) then an SSL connection is initiated. If the port number is 143 (110 for POP3) then it will try a non-SSL connection. With any other value the port will be tested to see if it supports SSL. If so, SSL will be used to make the connection; otherwise a non-SSL connection will be made. I do not issue any guarantee that this will work for you!
1 Preliminary NoteI'm using two servers here:
I want to migrate the mailbox sales@example.com (username: sales@example.com, password: secret) on server1.example.com to the mailbox sales@example.com on server2.example.com (username and password are the same as on server1.example.com).
2 Before We StartBefore we start, let's take a look at both mailboxes to see what's in them (you can do this with an email client such as Outlook, Thunderbird, or a web-based email client such as SquirrelMail - I'm using SquirrelMail here). server1.example.com: server2.example.com: After the migration, the three messages on server1.example.com should be available on server2.example.com.
3 IMAP TOOLS InstallationIt doesn't matter if we install IMAP TOOLS on server1.example.com or server2.example.com - we can even install it on a third, uninvolved server. We download and install the IMAP TOOLS scripts in the /usr/local/imap_tools/ directory as follows: cd /usr/local/ Now we have to make the Perl scripts executable: chmod +x /usr/local/imap_tools/*.pl
4 Migrating Email Messages From One IMAP Server To Another IMAP Server With imapcopy.plimapcopy.pl usage is as follows: /usr/local/imap_tools/imapcopy.pl -S host1[:port]/user1/password1 -D host2[:port]/user2/password2 So the command to copy email messages from sales@example.com on server1.example.com to sales@example.com on server2.example.com is: /usr/local/imap_tools/imapcopy.pl -S server1.example.com/sales@example.com/secret -D server2.example.com/sales@example.com/secret Here's a sample output: root@server1:/usr/local/imap_tools# /usr/local/imap_tools/imapcopy.pl -S server1.example.com/sales@example.com/secret -D server2.example.com/sales@example.com/secret On the target server (server2.example.com), you should now see the messages from server1.example.com: server2.example.com:
5 Migrating Email Messages From A POP3 Server To An IMAP Server With pop3toimap.plpop3toimap.pl usage is as follows: /usr/local/imap_tools/pop3toimap.pl -p POP3host[:port] -i IMAPhost[:port] -u users_file users_file has the following format: popUsername password imapUsername password So let's create the file /usr/local/imap_tools/users_file that contains the login details: vi /usr/local/imap_tools/users_file
The command to copy email messages from sales@example.com on the POP3 server server1.example.com to sales@example.com on the IMAP server server2.example.com is: /usr/local/imap_tools/pop3toimap.pl -p server1.example.com -i server2.example.com -u /usr/local/imap_tools/users_file If you get errors like Unexpected response to SELECT INBOX. command: 1 NO Mailbox does not exist, or must be subscribed to. open pop3toimap.pl... vi /usr/local/imap_tools/pop3toimap.pl ... and comment out line 123 ($mailbox = 'INBOX' unless $mailbox;) and add line 124 ($mailbox = 'INBOX';):
Then run the /usr/local/imap_tools/pop3toimap.pl -p server1.example.com -i server2.example.com -u /usr/local/imap_tools/users_file command again.Here's a sample output: root@server1:/usr/local/imap_tools# /usr/local/imap_tools/pop3toimap.pl -p server1.example.com -i server2.example.com -u /usr/local/imap_tools/users_file On the target server (server2.example.com), you should now see the messages from server1.example.com: server2.example.com:
6 Links
|







Recent comments
5 hours 39 min ago
12 hours 20 min ago
16 hours 11 min ago
17 hours 49 min ago
1 day 2 hours ago
1 day 11 hours ago
1 day 12 hours ago
1 day 16 hours ago
1 day 20 hours ago
1 day 20 hours ago