CalMail conversion and Unix mail

From UCB Math Wiki
Revision as of 22:23, 28 February 2009 by Vojta (talk | contribs) (Added the whole enchilada (draft version))
Jump to: navigation, search

This page describes how to use CalMail using tools similar to the Unix mail program (mailx).

After conversion to CalMail on April 1, incoming mail will no longer be stored on our system. Instead, it will be stored on the CalMail server, and will need to be accessed by a mail reader capable of using the IMAP protocol. The Unix mail program does not have this capability, so if you are using this program then you will need to make some changes in how you access your email.

This page describes two ways in which you will be able to handle your email using the familiar mail program or workalikes. (Of course, it is also possible to switch to a different mail client, or to use CalMail's web interface. In that case you should see the main CalMail wiki page.)

The first method of accessing mail involves a program called fetchmail, which copies your mail from the CalMail server into a file in your home directory. You then access the mail using the standard Unix mail program (or any other mail program, for that matter).

In the other method, you use the "Gnu" version of the Unix mail program, called gnumail. It functions very similar to the original mail program, but it is capable of using IMAP. In that case, gnumail is able to treat the CalMail server as if it were your inbox.

It is also possible to use both methods in combination with each other.

It should be noted, however, that the CalMail IMAP server for the math domain will not be operational until after the transition, so you will not be able to try out the methods described here until after April 1. (If you have access to another email account with an IMAP or POP server, however, you will be able to experiment with that server. Although the math department has its own IMAP server, it is not recommended that you use it to try things out. It has a bad habit of corrupting users' mailboxes, especially those with large amounts of incoming mail.)

Using fetchmail

Using the fetchmail program, you can copy your incoming mail from the CalMail server to a file within your home directory, and then read mail using your favorite mail client.

Initial setup

In the following descriptions, you should change username and password to your Math login name and your CalMail password, respectively. It is highly recommended that you use a different password for CalMail access than for logging in to the math system, since the CalMail password will likely be stored in a file in your home directory, and is vulnerable to being compromised.

After the transition, the directory /var/mail, which is used for storing users' inboxes, will no longer be available for that purpose. Therefore, you should choose a file within your home directory to use to hold incoming mail. The following examples use a file name "inbox", but you are free to change it to something else if you like.

In order for Unix mail to be able to find your new incoming mail box, you need to set an environment variable. To do this, add a line of the following form to the file .cshrc in your home directory:

setenv MAIL ~/inbox

Next, you need to provide fetchmail with the information it needs to be able to access your CalMail account. This is done by creating a file named .fetchmailrc in your home directory. This file should contain the following:

poll calmail.berkeley.edu username username@math.berkeley.edu pass password
  mda "procmail -f %F ORGMAIL=inbox DEFAULT=inbox"

Since this file contains your CalMail password, it should not be publicly readable. To make sure of this, use the following command:

chmod 600 ~/.fetchmailrc

In your .fetchmailrc file, the mda line is very important. Without it, your fetched mail will end up being sent back to CalMail, and will likely end up being lost, since CalMail will recognize it as already having been through their mail server once. Be sure it is exactly as given above (except for optionally changing your inbox).

Using gnumail

The Gnu version of the Unix mail program is capable of directly accessing your inbox on the CalMail server. You can do this on an ad hoc basis by naming the CalMail server directly on the command line:

gnumail -f imaps://username%40math.berkeley.edu@calmail.berkeley.edu

As in the description of fetchmail, you should replace username with your math department login name. After typing this command, gnumail will prompt you for your CalMail password.

Typing the above command is a bit inconvenient. It is recommended that if you plan to use gnumail often, then you set up gnumail to access your CalMail account by default. To do this, create a file named .mail in your home directory. Its contents should be as follows:

mailbox {
  mailbox-pattern "imaps://username%40math.berkeley.edu@calmail.berkeley.edu";
}

You can also avoid having to type in your password every time, by placing it in the .mail file:

mailbox {
  mailbox-pattern "imaps://username%40math.berkeley.edu:password@calmail.berkeley.edu";
}

Additional documentation on gnumail is available on the web.