Published on: June 3, 2011 by Arnold Pablo
Most of the hosting providers offer free server migration. The free website migration started as early as 2005, in the industry. But only a few providers offer the mail migrations for a website transfer involving different control panels. So using getmail is the easiest way to transfer emails. All we need is to create the email account in the new server and configure the getmail to transfer the emails.
Download getmail at http://pyropus.ca/software/getmail/old-versions/getmail-4.20.3.tar.gz
wget http://pyropus.ca/software/getmail/old-versions/getmail-4.20.3.tar.gz tar xzf getmail-4.20.3.tar.gz cd getmail* python setup.py install
Now you have to create a getmailrc , the getmail configuration file inside the home folder of the user. getmailrc need not be inside the home directory. You have to create the folder .getmail where getmail keeps a log of the emails retrieved based on each configuration file you may have.You can have multiple destination and retriever sections in one single getmailrc as well.
I must say getmail is so much flexible and rightly coded tool for mail migrations when the mailsync or imapsync didn’t do their job right or up to the mark. And is an excellent replacement for fetchmail. It supports POP, POP3S, IMAP4 and IMAPS, and also can store the mails retrieved in mbox or maildir format at the destination.
An extremely simple getmailrc file will look like this
[retriever] type = SimpleIMAPRetriever server = mail.domain.com username = firstname.lastname@example.org password = direct [destination] type = Maildir path = /home/cpusername/mail/.direct@domain_com/
The file format should be pretty self-explanatory. You’re telling getmail to fetch your email from server, mail.domain.com by logging to it using the mentioned username and password. The destination section mentions where to store the retrieved email and in which format (Maildir or mbox or mboxrd). Make sure that the cur, new and tmp are there inside those folder though. However getmail may create those folders automatically though.
Finally to get this going, just run “getmail –rcfile getmailrc”
Once you run it, assuming that the getmailrc is properly configured, you will be welcomed by a below output.
getmail version 4.20.3 Copyright (C) 1998-2009 Charles Cazabon. Licensed under the GNU GPL version 2. SimpleIMAPRetriever:email@example.com@mail.domain.com:143: msg 1/3983 (299328 bytes) delivered msg 2/3983 (2815 bytes) delivered
Category : cPanel, DirectAdmin, General, Howtos, Linux, Plesk, Training