Transferring sites from one server to another can sometimes be a pain in the butt...especially when dealing with email and propagation. You don't want to loose any email on the old server or have to try to get the customer to setup two email accounts to retrieve email from both servers during propagation. Well that is where fetchmail can come in handy.
For detailed information on fetchmail, see 'man fetchmail'
This HowTo will show you how to setup fetchmail to retrieve POP3 email from the old server and deliver it to the new servers user.
First you need to make fetchmail available to the virtual site.
Install Madsere's ensimpkg program and run addpkg for fetchmail on the domain.
fetchmail also uses 'uname', so you will either need to copy /bin/uname to the virtual sites /bin directory or create a link.
Once you have done that, you can start setting up the .fetchmailrc file that will be used to fetch the mail.
The user will need SSH access.
su user@domain.com
create a file called .fetchmailrc in the users home directory
cd
This will put you in the users home directory
vi .fetchmailrc
enter the following in the file
poll ip.of.old.server proto pop3
user "oldserveruser" with pass "oldserverpass" is "username@domain.com" here
keep
fetchall
This tells fetchmail to poll the old server IP using the pop3 protocol. Access mail for the old server username using the old server's password and deliver the mail to the new server user "username@domain.com". "keep" tells fetchmail to leave the mail on the old server. You can also use "flush" which will remove the mail. Problem with flush is that if there is an error during the transfer and the mail doesn't get delivered, it will be removed from the old server and lost. I have found that leaving it set to "keep" is a little safer and I can go to the old server and delete the emails manually when I have verified that the mail was transferred successfully. "fetchall" tells fetchmail to get all emails in the old servers account.
That is pretty much it. Now it is just a matter of running fetchmail when signed in as the user on the new server.
fetchmail
That's all there is. Fetchmail has a number of other useful features such as running in daemon mode which can be set to check for mail on the old server every X number of seconds.
When in doubt "man fetchmail"
