Move mbox Calmail

From UCB Math Wiki
Revision as of 19:20, 1 April 2009 by SteveSizemore (talk | contribs) (xfermail)
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.

As an alternative, we have a script, called xfermail, that you can use to transfer Unix mailbox files to CalMail.

Another possibility is to use an updated version of the Unix mail command, called nail. It requires a bit more setup, though.

This page also describes two older applications similar to xfermail. They are not recommended, though, since they set the messages' received date/time to the current date and time, and also mark all transferred messages as being unread. These older applications are called movemail and mbox2imap.

xfermail

The Math Department provides an application, called xfermail, to transfer Unix mailbox files to folders on the CalMail server.

To transfer your system mailbox, just run it without arguments:

xfermail

It will print a confirmation message, that it is transferring your file /var/mail/username (where username is your login name) to your INBOX on CalMail. It then asks you for your CalMail password, and then prints a line of the form

"imaps://username@math.berkeley.edu@calmail.berkeley.edu" [Appended] 65/2348

To transfer a mailbox other than your system mailbox to CalMail, invoke xfermail as follows

xfermail file folder

where file is the file on the math department file system, and folder is the name of the folder on the CalMail server. (You can omit the folder argument, in which case it'll put the mail in your inbox. This is probably not what you want, since the contents of file are not in your inbox here.

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.
  • Documentation on xfermail is available by running the command "xfermail -h" or "xfermail --help" (without the quotes).
  • Mail will remain in the old location after running xfermail. 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. (The xfermail script actually calls nail to perform its function.)

Before using nail, 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 available on all math department machines except for the FreeBSD server blue2.
  • Documentation on nail is available by running the command "man nail" (without the quotes). Note that the man page refers to the command as mailx, but it is installed on our system as nail. (The name mailx is already "taken", since it refers to the system command.)
  • 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.

movemail (deprecated)

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 (deprecated)

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 available on all math department computers.
  • 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.