Move mbox Calmail

From UCB Math Wiki
Revision as of 17:16, 26 March 2009 by Vojta (talk | contribs) (Fixed missing right parenthesis)
Jump to: navigation, search

Moving mailboxes to Calmail

Shortly after the transition to CalMail, currently scheduled for April 6 or thereabouts, you will need to transfer your system mailbox (the file /var/mail/username, which your mail client may refer to as your inbox) to the CalMail server. The Math Department systems staff cannot do this for you, as they do not have your CalMail password.

You may also want to move other mailbox files to CalMail. Possible examples of this include your file of read mail (the file mbox in your home directory) and other files to which you've stored mail. It is also possible that you may want to leave them where they are. Whether to move them depends on what mail client you are using, how you plan to handle your mail after the transition to CalMail, and other factors too numerous to ponder here.

Introduction

First, your mail is still available via IMAP, and the new server (calmail.berkeley.edu) is also running IMAP. There is a good chance that you'll be able to move your old mail to your new calmail account simply by copying from within your mail client.

In the case where there is some problem with the old mail folder (e.g. the size is too large), you can use unix command line tools to manipulate the folders.

There are two dedicated applications, movemail and mbox2imap, that can be used to transfer a file to CalMail. These have the drawbacks of setting the message's received date/time to the current date and time. They also mark all transferred messages as being unread.

Another possibility is to use an updated version of the Unix mail command, called nail. This correctly preserves the received-times for the messages, and the read/unread status. It requires a bit more setup, though.

movemail

movemail is part of the Gnu mailutils package, and is designed for the purpose of moving mail from one mailbox to another.

To use it to move your system mailbox, type the command:

movemail -p /var/mail/username imaps://username%40math.berkeley.edu@calmail.berkeley.edu

where username is your Unix login name. To move an auxiliary mailbox to a folder on CalMail, type

movemail -p file imaps://username%40math.berkeley.edu@calmail.berkeley.edu/folder

where file is the name of the file currently containing the messages, and folder is the name of the CalMail folder that is to receive them.

Notes

  • Before moving mail into a folder, that folder has to be created on the CalMail server. That can be done using your mail program, or using Calmail's web interface.
  • The characters "%40" is not a typo. This is how the Gnu mailutils package requires the "at" symbol to be represented in IMAP usernames.
  • After being transferred, the messages will show up as having all been received as of when you ran the movemail command.
  • After being transferred, all of the messages will have their status changed to unread.
  • movemail will ask you for your CalMail password each time you run it.
  • The movemail command is only available on Solaris systems, such as the login servers blue1 and blue3. It is not available on login.math.berkeley.edu.
  • Documentation on movemail is available on the web, at http://www.gnu.org/software/mailutils/manual/html_node/movemail.html#movemail.
  • Mail will remain in the old location after running movemail (this is what the -p option does). It is up to you to delete the mail from its previous location, but you should not do so until after you have checked that it has been transferred correctly.

mbox2imap

mbox2imap is a python script that is very similar to movemail.

To use it to move your system mailbox, type the command:

mbox2imap -u username@math.berkeley.edu -s calmail.berkeley.edu /var/mail/username

where username is your Unix login name. To move an auxiliary mailbox to a folder on CalMail, type

mbox2imap -u username@math.berkeley.edu -s calmail.berkeley.edu -i folder file

where file is the name of the file currently containing the messages, and folder is the name of the CalMail folder that is to receive them.

Notes

  • Before moving mail into a folder, that folder has to be created on the CalMail server. That can be done using your mail program, or using Calmail's web interface.
  • After being transferred, the messages will show up as having all been received as of when you ran the mbox2imap command.
  • After being transferred, all of the messages will have their status changed to unread.
  • mbox2imap will ask you for your CalMail password each time you run it.
  • The mbox2imap command is only available on Linux systems, such as the login server login.math.berkeley.edu.
  • Documentation on mbox2imap is rather sparse. Run it without arguments to receive a brief usage summary.
  • Mail will remain in the old location after running mbox2imap. It is up to you to delete the mail from its previous location, but you should not do so until after you have checked that it has been transferred correctly.

nail

nail is a newer version of the Unix mail program, and has been updated to support the IMAP protocol.

Before using it, you have to set up some files in your home directory. The procedure for doing so is given in the page on CalMail conversion and Unix mail.

After this setup step, you can move your system mailbox by typing the commands:

nail -f /var/mail/username
save * +INBOX
exit

where username is your Unix login name. To move an auxiliary mailbox to a folder on CalMail, type

nail -f file
save * +folder
exit

where file is the name of the file currently containing the messages, and folder is the name of the CalMail folder that is to receive them.

Notes

  • If the folder does not exist yet on the CalMail server, then it will be created. However, additional steps may be needed to get it to show up on your mail client. For example, on the CalMail web interface, you will need to "subscribe" it.
  • This procedure keeps the messages' date and time of receipt, and preserves their status of being read or unread.
  • The nail command is only available on Solaris systems, such as the login servers blue1 and blue3. It is not available on login.math.berkeley.edu.
  • Documentation on nail is available by running the command "man nail" (without the quotes).
  • Mail will remain in the old location after running nail. It is up to you to delete the mail from its previous location, but you should not do so until after you have checked that it has been transferred correctly.