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:

  1. server1.example.com (source machine)
  2. 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:

cd / usr / local /
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:

chmod + x /usr/local/imap_tools/*.pl

4. Move email between two IMAP servers with imapcopy.pl

We use imapcopy.pl with the following command:

/usr/local/imap_tools/imapcopy.pl -S host1 [: port] / user1 / password1 -D host2 [: port] / user2 / password2

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:

/usr/local/imap_tools/imapcopy.pl -S server1.example.com/sales@example.com/secret -D server2.example.com/sales@example.com/secret

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:

/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 need to create the file / usr / local / imap_tools / users_file containing the login details:

en / usr / local / imap_tools / users_file
sales@example.com secret sales@example.com secret

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:

/usr/local/imap_tools/pop3toimap.pl -p server1.example.com -i server2.example.com -u / usr / local / imap_tools / users_file

If you get an error:

Trả lời không mong đợi để SELECT INBOX. lệnh: 1 không có thư mục không tồn tại, hoặc phải được đăng đăng vào.
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. .

en /usr/local/imap_tools/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:

/usr/local/imap_tools/pop3toimap.pl -p server1.example.com -i server2.example.com -u / usr / local / imap_tools / users_file

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/

4 ★ | 76 Vote

May be interested

  • Transfer mailboxes in Exchange 2007 through the Exchange Management ConsoleTransfer mailboxes in Exchange 2007 through the Exchange Management Console
    there are many tasks that every exchange administrator must perform daily and moving mailboxes is one of those tasks. the most obvious example of mailbox migration is when a user is moved from one exchange server to another
  • How to Find Incoming Mail ServersHow to Find Incoming Mail Servers
    to receive mail in email readers such as outlook, thunderbird or email applications on your phone, you need to collect incoming mail server information, including incoming mail server address, software port and device protocol type. server (pop3 or imap). it sounds difficult, but actually everything is available and very easy to find once you know where it is hidden.
  • Managing mailboxes in Exchange Server 2007 (Part 2)Managing mailboxes in Exchange Server 2007 (Part 2)
    we have seen the first part about managing mailboxes in exchange server 2007, in part two we can analyze this issue in more depth. in this article, we will look at information in mailboxes, blocking, reconnecting and advanced mailbox features.
  • Add Gmail account to Outlook 2010 with IMAPAdd Gmail account to Outlook 2010 with IMAP
    if you want to upgrade outlook 2003 to 2010, you need to use imap with your gmail account to synchronize mail from different machines. follow our instructions, you can use your mail account in any computer.
  • Top 5 leading WMI toolsTop 5 leading WMI tools
    windows management instrumentation, or wmi, is a technology that makes it easier to manage microsoft windows-based servers and workstations.
  • The basic advantages of Linux servers and Window serversThe basic advantages of Linux servers and Window servers
    you plan to hire a server service to build a website for small businesses, but you need to know the basics of network servers. the whole purpose and total characteristics of a website are the factors that form the server selection
  • Manage mailboxes in Exchange Server 2007Manage mailboxes in Exchange Server 2007
    in this article, we will approach the management of mailboxes in exchange server 2007. this seems to be a simple discussion but we will look at some advanced points related to management tasks. users to support those
  • This Upcoming Windows Tool Will Make It Easier for Users to Switch to a New PCThis Upcoming Windows Tool Will Make It Easier for Users to Switch to a New PC
    microsoft has now been spotted testing a wireless data transfer feature that would make switching pcs easy.
  • How to turn on POP / IMAP Gmail to use in OutlookHow to turn on POP / IMAP Gmail to use in Outlook
    suppose in some case when you try to connect an outlook account to a gmail account, but an error cannot be reached. to fix this error, please refer to the following article of network administrator.
  • Instructions for adding email accounts to Gmail on iPhone, iPadInstructions for adding email accounts to Gmail on iPhone, iPad
    google allows you to add third-party email accounts to the gmail app on iphone and ipad. thus, you can simultaneously manage icloud, outlook, yahoo, imap accounts and gmail accounts.