Difference between revisions of "CalMail conversion and Unix mail"

From UCB Math Wiki
Jump to: navigation, search
(Switched from gnumail to nail; updated comments about trying out the CalMail server)
Line 15: Line 15:
 
[[CalMail conversion]] wiki page.)
 
[[CalMail conversion]] wiki page.)
  
The first method of accessing mail involves a program called '''fetchmail''',
+
The recommended way of accessing mail consists of using a newer version
 +
of the Unix '''mail''' program, called '''heirloom mailx'''.  This name is
 +
rather awkward, so we'll call it by its previous name, '''nail'''.
 +
It functions very similarly to the original mail program, but it is capable
 +
of using IMAP (and has many other enhancements).  Because of this, '''nail'''
 +
is able to treat the CalMail server as if it were your inbox.
 +
 
 +
An alternative way of accessing mail involves a program called '''fetchmail''',
 
which copies your mail from the CalMail server into a file in your home
 
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'''
 
directory.  You then access the mail using the standard Unix '''mail'''
 
program (or any other mail program, for that matter).
 
program (or any other mail program, for that matter).
  
In the other method, you use the "Gnu" version of the Unix '''mail''' program,
+
It is also possible to use both methods in combination with each other.
called '''gnumail'''.  It functions very similar to the original mail program,
+
 
but it is capable of using IMAPIn that case, '''gnumail''' is able to treat
+
If you have set up your CalMail password already, then you can experiment
the CalMail server as if it were your inbox.
+
with these methods (although you won't be able to process incoming mail
 +
until after the transition).  You can also try them with other IMAP or POP
 +
accounts that you may have.  (Although the Math Department has its own
 +
IMAP server, it is not recommended that you use this particular server
 +
to try things out.  It has a bad habit of corrupting users' mailboxes,
 +
especially those with large amounts of incoming mail.)
 +
(Note also that '''nail''' is currently installed only on Solaris machines,
 +
such as the login servers '''blue1''' and '''blue3'''.)
 +
 
 +
== Using nail ==
 +
 
 +
The "heirloom mailx" version of the Unix mail program (called '''nail''')
 +
is capable of directly accessing your inbox on the CalMail server.
 +
 
 +
=== Initial setup ===
 +
 
 +
To set up '''nail''' for accessing your CalMail account, you need to add
 +
the following line to the file '''.mailrc''' in your home directory:
 +
set NAIL_EXTRA_RC=~/.nailrc
 +
(If you currently do not have such a file, create it with just that one line.)
 +
 
 +
Then, you should create a file '''.nailrc'' in your home directory,
 +
which should look something like this:
 +
unset hold
 +
unset emptybox
 +
set crt bsdflags
 +
 +
account calmail {
 +
    set folder=imaps://'''''username'''''@math.berkeley.edu@calmail.berkeley.edu
 +
  }
 +
 +
account calmail
 +
In the above, you should replace '''''username''''' with your Unix login name.
 +
When you start up '''nail''', it will then ask for your CalMail password.
 +
 
 +
You can avoid having to type your password every time by adding a line
 +
set password-'''''username'''''@math.berkeley.edu@calmail.berkeley.edu="'''''password'''''"
 +
to your '''.nailrc''' fileAgain, '''''username''''' should be replaced
 +
by your Unix login name and '''''password''''' by your CalMail password.
 +
This line can be anywhere in the file outside of the set of braces.
  
It is also possible to use both methods in combination with each other.
+
If you place your CalMail password in the '''''.nailrc''''' file, then
 +
you should ensure that this file is ''not'' publicly readable, by issuing
 +
the command
 +
chmod 600 ~/.nailrc
  
It should be noted, however, that the CalMail IMAP server for the math domain
+
More information on '''nail''' is available on its extensive man page, which
will not be operational until after the transition, so you will not be able
+
can be obtained by typing:
to try out the methods described here until after April 1.  (If you have
+
man nail
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.)
 
(Note also that '''gnumail''' is currently installed only on Solaris machines
 
(such as '''blue1''' and '''blue3''').)
 
  
 
== Using fetchmail ==
 
== Using fetchmail ==
Line 80: Line 122:
 
already having been through their mail server once.  Be sure it is
 
already having been through their mail server once.  Be sure it is
 
exactly as given above (except for optionally changing your inbox).
 
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";
 
}
 
 
[http://www.gnu.org/software/mailutils/manual/html_node/mail.html#mail Additional documentation]
 
on '''gnumail''' is available on the web.
 

Revision as of 21:17, 24 March 2009

This page describes how to use CalMail using tools similar to the Unix mail program (mailx, generally accessed by typing "mail").

After conversion to CalMail on April 6, 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, our recommendation is to switch to a different mail client, or to use CalMail's web interface. In that case you should see the main CalMail conversion wiki page.)

The recommended way of accessing mail consists of using a newer version of the Unix mail program, called heirloom mailx. This name is rather awkward, so we'll call it by its previous name, nail. It functions very similarly to the original mail program, but it is capable of using IMAP (and has many other enhancements). Because of this, nail is able to treat the CalMail server as if it were your inbox.

An alternative way 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).

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

If you have set up your CalMail password already, then you can experiment with these methods (although you won't be able to process incoming mail until after the transition). You can also try them with other IMAP or POP accounts that you may have. (Although the Math Department has its own IMAP server, it is not recommended that you use this particular server to try things out. It has a bad habit of corrupting users' mailboxes, especially those with large amounts of incoming mail.) (Note also that nail is currently installed only on Solaris machines, such as the login servers blue1 and blue3.)

Using nail

The "heirloom mailx" version of the Unix mail program (called nail) is capable of directly accessing your inbox on the CalMail server.

Initial setup

To set up nail for accessing your CalMail account, you need to add the following line to the file .mailrc in your home directory:

set NAIL_EXTRA_RC=~/.nailrc

(If you currently do not have such a file, create it with just that one line.)

Then, you should create a file '.nailrc in your home directory, which should look something like this:

unset hold
unset emptybox
set crt bsdflags

account calmail {
   set folder=imaps://username@math.berkeley.edu@calmail.berkeley.edu
}

account calmail

In the above, you should replace username with your Unix login name. When you start up nail, it will then ask for your CalMail password.

You can avoid having to type your password every time by adding a line

set password-username@math.berkeley.edu@calmail.berkeley.edu="password"

to your .nailrc file. Again, username should be replaced by your Unix login name and password by your CalMail password. This line can be anywhere in the file outside of the set of braces.

If you place your CalMail password in the .nailrc file, then you should ensure that this file is not publicly readable, by issuing the command

chmod 600 ~/.nailrc

More information on nail is available on its extensive man page, which can be obtained by typing:

man nail

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).