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:
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 :
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:
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 :
Reference links
IMAP TOOLS: http://www.athensfbc.com/imap_tools/