Move mailboxes between IMAP servers with IMAP TOOLS
TipsMake.com - IMAP TOOLS is a collection of Perl scripts, allowing you to do many different tasks with IMAP server as well as POP3. In the following article we will guide you to move mailboxes between IMAP servers using IMAP TOOLS. The content mainly focuses on imapcopy.pl scripts (copies of messages and mailboxes from another IMAP server) and pop3toimap.pl (copies of POP3 messages to IMAP servers). Both scripts support SSL.
>>>Move mailboxes between IMAP servers with IMAPcopy
If you specify port 993 ( 995 for POP3) then an SSL connection will be initialized. If the port number is 143 (110 for POP3) it will try a non-SSL connection. For any other value, ports will test whether SSL is supported. If so, SSL will be used to create the connection, but there will still be a non-SSL connection.
1. Some notes
Here we use two servers:
- server1.example.com (source machine)
- server2.example.com (target machine)
The request is to transfer the mailbox from sales@example.com (username: sales@example.com , password: secret ) on server1.example.com to the mailbox of sales@example.com on server2.example .com (the same username and password as the other server).
2. Prepare
Before we get started, let's check both mailboxes to see what's in it (you can do this by any email client service like Outlook, Thunderbird or web mail like SquirrelMail we use below.) here).
server1.example.com:
Move mailboxes between IMAP servers with IMAP TOOLS Picture 1
server2.example.com:
Move mailboxes between IMAP servers with IMAP TOOLS Picture 2
After executing this tutorial, three messages in server1.example.com will appear in server2.example.com .
3. Install IMAP TOOLS
It is not important to install IMAP TOOLS on server1.example.com or server2.example.com , you can even install it on a 3rd machine without any trouble.
We download and install the IMAP TOOLS scripts according to the following directory path:
mkdir imap_tools
cd imap_tools
wget http://www.athensfbc.com/imap_tools/files/imap_tools_V1.105.tar.gz
tar xvfz imap_tools_V1.105.tar.gz
Now execute the Perl scripts:
4. Move email between two IMAP servers with imapcopy.pl
We use imapcopy.pl with the following command:
So apply the case here to copy the email from sales@example.com on server1.example.com to sales@example.com on server2.example.com as follows:
The output will look like this:
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 /usr/local/imap_tools/imapcopy.pl starting Connected to server1.example.com on port 143 Authenticating to server1.example.com as sales@example.com Connected to server2.example.com on port 143 Authenticating to server2.example .com as sales@example.com Number of mailboxes to process: 5 Drafts mailbox is empty thư mục Junk là empty Trash thư mục empty Sent thư mục không có thể Copied 3 thông báo vào INBOX Copied 3 total messages root @ server1: / usr / local / imap_tools #
Now on the destination server (server2.example.com ) will see the email from server1.example.com :
Move mailboxes between IMAP servers with IMAP TOOLS Picture 3
5. Move email from POP3 server to IMAP server with pop3toimap.pl
You can use pop3toimap.pl with the following command:
Users_file has the following format:
So need to create the file / usr / local / imap_tools / users_file containing the login details:
And finally, the command line to copy emai from sales@example.com on POP3 server: server1.example.com to sales@example.com on the IMAP server: server2.example.com is:
If you get an error:
bất thường APPEND câu lệnh: 1 không truy cập được cho APPEND trên INBOX (ACL "i" required)
Fix by opening pop3toimap.pl. .
. and create comments at line 123 ( $ mailbox = 'INBOX' unless $ mailbox; ) and add line 124 ( $ mailbox = 'INBOX'; ):
[.] foreach $ msgnum (@popMsgList) {if ($ range) {Log ("msgnum $ msgnum") if $ debug; next if $msgnum < $lower; next if $ msgnum <$ lower; next if $msgnum > $upper; next if $ msgnum> $ upper; } Log("Fetching POP message $msgnum") if $debug; } Log ("Fetching POP message $ msgnum") if $ debug; $ msg = getPOPMsg ($ msgnum, $ p_conn); getFlag ($ msg, $ flag); getDate ($ msg, $ date); next if $ msg eq ''; # $ mailbox = 'INBOX' unless $ mailbox; $ mailbox = 'INBOX'; selectMbx ($ mailbox, $ i_conn); if (insertMsg (* msg, $ mailbox, $ date, $ flag, $ i_conn)) {$ copied ++; $ grandTotal ++; Log ("$ copied messages migrated") if $ copied / 100 == int ($ copied / 100); # Delete the message from the POP server if flag delete được đặt deletePOPMsg ($ msgnum, $ p_conn) if $ delete; }} [.]
Then run the command again:
The results shown are as follows:
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 pop3toimap 1.3 starting There are 1 user to be connected to server1.example.com on port 110 Connected to server2.example.com on port 143 Migrating sales@example.com on server1.example.com to sales@example.com on server2.example.com ( 3 messages) Summary of POP3 -> IMAP migration Users migrated 1 Total messages 3 Total bytes 2912 root @ server1: / usr / local / imap_tools #
Now on the destination server ( server2.example.com ) will see the email from server1.example.com :
Move mailboxes between IMAP servers with IMAP TOOLS Picture 4
Reference links
IMAP TOOLS: http://www.athensfbc.com/imap_tools/
You should read it
- Move mailboxes between IMAP servers with IMAPcopy
- Learn about the IMAP protocol
- How to set up an IMAP server for an Outlook.com account
- Differentiate POP and IMAP
- 4 reasons to switch to IMAP
- 4 reasons to use IMAP service
- How to set up IMAP / POP, CalDAV or CardDAV accounts on iPhone or iPad
- How to set up Gmail to use IMAP
- Add Gmail account to Outlook 2010 with IMAP
- Email: Differences between POP3, IMAP and Exchange
- Instructions for adding email accounts to Gmail on iPhone, iPad
- How to add and delete Email accounts on Mac, iPhone and iPad
May be interested
Configure, set Incoming and Outgoing Email on SharePoint 2010 - Part 1
Configure, set Incoming and Outgoing Email on SharePoint 2010 - Part 2
Transfer Exchange 2003 to Exchange 2007 (P.4)
Prepare Active Directory for Exchange 2007 (Part 3)
Transfer Exchange 2003 to Exchange 2007 (P.5)
Transfer Exchange 2003 to Exchange 2007 (P.6)