Mail

There are two strategies for using Email. You can either use your current mail system, either Exchange or Unix Mail, or you can use the Mac mailer with Imap. Most Mac users prefer the latter as the Mac Mailer is both simple to use and very powerful.

For Unix Mail Users

If you are a Unix mail user and you want to continue using Unix mail, then keep doing whatever you are doing now. If you log in to a department machine to read mail, then you can keep doing that (the Mac supports ssh). If you use pop, then you can continue to do that with the Mac mailer, or any one of a number of other Mac clients (there is Eudora for the Mac, for example -- see google for details).

An alternative to using the Unix mail interface is to switch to using an Imap client and have your mail served up from one of the department's Imap mail servers. See this page for more information on Imap. Basically, you've got to get lab to make a mailbox for you at mylogin.mail.cs.washington.edu and to ensure that your mail is directed to the machine hosting that DNS name.

You now need to configure your Mail client to speak to the departmental mail servers. There are two aspects of configuration: getting your mail and sending your mail. I'll describe both below, assuming that you are using the Mac Mail program. If you are using another Mail client, such as Eudora, you'll need to map these instructions into those appropriate for your client.

1. Create a new mail account in Mac Mail.

2. Under Account Information, specify account type Imap, give your CS
email address, your incoming mail server as
mylogin.mail.cs.washington.edu, where "mylogin" is your email
address. Finally, give your UW CSE password.

3. Under outgoing mail server, you can either specify
mailhost.cs.washington.edu, which will have outgoing mail sent
through the department's mail server, or specify smtp.washington.edu,
which will send outgoing mail through the campus mail server.  Here,
you will need to set the options so that outgoing mail is sent using
secure sockets and the authentication method is "password."  Give
your login name and password. If you are sending through
smtp.washington.edu, your login and password should be those of your
UW netid, otherwise they should be your CS login and password.

4. Under "Advanced Options" you need to provide two paths.  The
first, called "Account Directory" is the directory on your Mac where
you want mail to be cached or stored.  The second, Imap Path Prefix,
is the path relative to your home directory on your imap server
(mylogin.cs.washington.edu) where mail should be kept.  I use the
directory "Imap" here.  If you leave this off, your mail client will
scan your home directory and interpret all of your folders as Mail
folders. This is a bit strange.

5. Also under advanced options, specify port 993 for Imap, Use SSL,
and use Password authentication. If you don't do this, mail won't
work.

The reason why you might consider sending outgoing mail through smtp.washington.edu, rather than the department mailer is that the department mailer has some funny behaviors for mail sent to unknown addresses. Specifically, it silently rejects mail sent to bad addresses, whereas the campus mailer will return it back to you. Support claims that the department mail server provides this silent rejection as a "feature." Caveat Mailer.

For Exchange Users

Exchange users have to deal with two problems simultaneously. First, the MS Exchange server has a very poor Imap server. It tends to lock up under even moderate load. Consequently, lab has (smartly) disabled Imap service for our Exchange server. Second, the Mac is a poor Exchange client. The only native Exchange client for the Mac runs under OS 9 emulation, which is not very reliable. Don't use it. Entourage, the MS "Exchange client" that ships with Office X is really an Imap client -- it does not speak Exchange natively, so you can't use it to talk to our Exchange server.

NOTE: As of Oct 2003, MS has released a new version of Entourage, so if you want to try it, see the MS page which describes how to get it. The flowchart is particularly enlightening :-). Otherwise, read on.

Consequently, as an Exchange user, you must make a choice as to how to access your mail. One option is to struggle with the OS 9 emulator client and simply restart whenever it fails. This gets old pretty fast however. The second option is to run Outlook in a Virtual PC emulator. Believe it or not, this works. The problem in the end though is with integrating your mail with everything else you like to do (like print, save files, etc). It's doable, but it's a pain. A third option is to use OWA to access your mail via a web browser. This is good in a pinch, but the OWA interface is clunky for anything serious. I don't recommend you do this.

This leads us to the fourth option: stop using Exchange. While this may sound scary, it's really not all that bad, and once you're off of Exchange, you'll wonder how you ever managed to live with it. Basically, Exchange offers you four functions:

1. Remote mail service with backed up repository
2. Client side caching
3. An Address Book
4. Shared calendaring
The Mac Mailer plus Imap gives you #1 and #2, with a couple of added bonuses. First, it's got a caching behavior that makes sense. If you cache mail on your local machine, then it's available even when the network is not. Despite having used Exchange for 5 years, I was never able to figure out how to make this work reliably with Outlook (invariably, when I would try to look at a mail message, my machine would want to go to the network). The second thing you get is an ascii file format for Mail (both cached and remote). Indeed, the file format is simply the Unix mail file format. This means that you can use tools like grep and emacs to deal with your mail after it has arrived.

Although the Mac Mailer does not give you an address book directly, it is very well integrated with the separate Mac Address Book application. So, if there's a name in your address book, the Mac Mailer knows how to read it.

The Mac mail DOES NOT GIVE you shared calendaring however. This is currently a big drawback with the Mac. If you are a heavy user of shared calendaring in Microsoft Exchange, and the alternatives are not appropriate for you, then you will need to run an Exchange client on your Mac for calendaring (you may choose to also use it for Mail, but I would recommend against it. Calendaring is pretty stylized and doable under Virtual PC.)

I recommend that you have a look at the native Mac calendaring program (iCal) and see if it provides a viable solution to your calendaring needs. With iCal you can publish your calendar to other Mac users (either by way of .Mac services, or by way of a WebDAV server run by the department). Alternatively, you can also publish your calendar for the whole world (literally) to see on your .Mac account. Although they can see it, they can not change it. Be aware as well that your calendar is WORLD READABLE if you do this.

How to Stop Being an Exchange User

If in fact you decide that you would like to migrate off of Exchange, please read the following carefully. I've already gone through this process, and in retrospect, it's pretty straightforward, but there are a few landmines that could suck down a lot of time if you are not careful.

The basic problem you'll be dealing with here is the following: Exchange is a bit like the Roach Motel, users go in, but they don't come out. It's very easy to import addresses and email into Exchange or any one of its clients, but there is no similar obvious path for going the other way. There is in fact an easy path -- it's just not that obvious.

How to migrate your contacts from Exchange to the Mac Address Book

This is a three step process.
1. First, from an outlook client export your
addresses to a tab delimited file in Windows format.  Follow the
File|Export from the toolbar.  Say you've called that file foo.txt.

2. Then, move the file over to your Mac. (If you run the outlook client
inside Virtual PC, you can skip this step if you save the file onto a
Mac Shared folder).  

3. Then, on your Mac, from the Finder, open "/Library/Scripts/Mail/Import Addresses.scpt"
(in Applications/Apple Script).  Select "Controls|Run."  You'll be
asked to choose the application to import from.  Select "Entourage".
Then, specify that you want to import from a file and give it the
file that you put on your Mac in step 2.

After anywhere from a few seconds to a few minutes, all of your addresses will be imported into your Mac's address book.

How to migrate your mail from Exchange to the Mac Mailer

This one is trickier.

First thing to do is ask lab to change your department mail address from the exchange server to your unix imap account. At the same time, ask them to setup a forwarding rule so that all mail that is received on the exchange server is automatically forwarded to your Unix account. You can't simply turn off your exchange account because you will still need access to get your old mail off, or if you intend to use exchange for calendaring. Note that you need to force forwarding explicitly on exchange because exchange assumes that any mail sent from an exchange user to an exchange user should stay within exchange. If you don't request forwarding, you won't see mail sent to you from other exchange users.

The next thing to do is get your mail off of exchange and on to the Imap server. This is harder than it sounds. What you'd like to be able to do is say "Outlook, please save my file in a format that can be read by another mail client. You can't. At least not directly. You have to do it indirectly. Here are your options. Choose whichever is doable for you and which sounds easiest

The first option is the easiest. If you are running Outlook XP, add your Imap server as mailbox. Then, copy all of your Exchange mailboxes to your Imap server. Note: I've not tried this, but the documentation for Outlook XP suggests that this should work. (Unfortunately, this won't work in Outlook Express, which doesn't let you move folders across Imap servers!).

The next option is to wait until MS delivers a version of Entourage that works with the native Exchange protocol. Then, you can either run Entourage to access your Exchange mail, OR you can follow the steps in the previous paragraph to move your mailboxes from Entourage (exchange server) to Entourage (Imap server). From the press release howewer, it's not clear how long you'll have to wait for this. Other documents hint that this will be ready sometime Summer 2003.

Another option is to lobby lab to reenable imap service on the exchange server. Then, create an imap account on Mac Mail, connect to the exchange server, and copy all the mail folders to your local machine. Then, connect to your Unix Imap account, and copy all the folders back over to the new server. This will work as long as the exchange server doesn't freeze up in the middle.

The remaining option is basically straightforward. You will ask Outlook to make a mail archive, then you'll go to a Linux machine where you can run a program to convert from Outlook's PST format to Unix Mail format. Then, you'll copy the Mail that you just created over to our Mac. Then, you'll ask the Mac Mail program to import the mail. Finally, you'll move the newly imported Mail folders to your Imap server directly from within the Mac Mail client.

Here are the steps to follow.

To export your mail to a PST file, start up outlook on a Windows box (or in Virtual PC for Mac running Windows) and select File|Export and then select all. Put the mail into a PST file called "migrate.pst". It's likely to be large.

Now, copy the pst file onto a Linux machine (you can use Virtual PC running Linux if you like).

Now, get yourself a copy of "readpst" which is a Linux program that converts outlook PST files into standard Unix mail format. You can do this either by visiting this archive, and then compiling the libpst tree you download, OR you can simply save this link to a file called "readpst" to get a pre-compiled version.

Now, follow these instructions exactly as I've specified:

1. On the Linux box, make a new directory called Migrate.
2. Move the migrate.pst file into Migrate.
3. Move the readpst file into Migrate
4. CD into the Migrate directory.
4. Make a new directory called Target in the Migrate directory.
5. run:  ./readpst -o Target -r migrate.pst
6. You now have a new directory filled with all your mail in Unix mail
format.
7. Copy the Target directory to your Mac machine (put it someplace
unimportant, like /tmp)
8. Start up Mac Mail and select 'File|Import Mailboxes'
9. Choose "Standard mbox files"
10. When asked for the name of the folder, use "/tmp/Target"
11. You'll now be shown a bunch of checked mail folders.  Assuming
you want them all, select "OK".
12. The mail will be imported and placed in a Mail folder "On My Mac"
13. You can now copy the folders you want directly to your Imap
server. This may take some time, so be patient.

That's it. Your mail is now on the Imap server.

At this point, if you don't need Exchange any longer, send a message to support and tell them to deactivate your exchange account. You're free.

How to specify an LDAP server to the Mac Mail client

You can have the Mac Mail client automatically complete addresses according to our departmental LDAP server's database. To do this, go to the account tab for your CSE account, and go to the Composing tab. Under "addressing" specify "automatically complete addresses" and then click on "Configure LDAP..." Add a new server with the following properties (EXACTLY AS THEY ARE HERE):
Name: UW LDAP Server
Server: directory.cs.washington.edu
Search Base: 
Port: 389
Scope: Subtree
That is, leave the Search Base empty.

With this, mail recipient names will be automatically expanded if they can be found in the department's LDAP database. NOTE: The dept web pages on LDAP say that search base should be

 ou=Computer Science and Engineering,o=University of Washington,c=UW
Try leaving it blank. If that doesn't work, try setting the search base.

Lastly, LDAP only works when you are coming in from a CS host. It will fail silently from elsewhere.

How do I create a new Mail folder with the Mac Mailer?

The Mac Mail client allows you to put msgs in folders, and folders in folders that only contain folders, but you can not put a folder in a folder that also contains messages. Similarly, you can move a message to a folder that has only msgs in it, but you can not move a msg to a folder that contains a folder.

So, if you want create a folder called A in your root mail directory, and you intend to put only mail in it, then select your root mail folder in the Mailer and opt-click-NEW-MAILBOX... and specify A.

If you want to create a folder B in your root mail directory and you intend to put a subfolder C in it that will contain only mail then specify NEW-MAILBOX with the new name B/C.

At this point, you can put mail in C, but can not use C for more folders. And you can use B for more folders, but can not put mail in it.

If you find that you want to change your structure (eg, you want to make A a folder containing folders) than make a new folder D/SomeFolderName and then move all the mail from A to SomeFolderName, delete A, and then rename D to A.

Why is it this way?

Because "folders" containing mail are implemented by the UW IMAP SERVER (that is, the one written here at UW) as files and folders containing only folders are implemented as directories. If you tried to create a subfolder in a mail folder, the server would want to create a directory inside a file, which would be a little bit like when Spock asked M5 to compute pi to the last digit. M5, not being as smart as either the Mac mailer or the UW IMAP server, gave it its best shot, but then ends up seg faulting, thereby saving the crew from a runaway computer. This sort of thing happens all the time with the Exchange server, so it's easy to appreciate the Mac Mailer's built in limitation.

The Mac mailer is pretty clear about this limitation when you are creating a new folder when it says "if you want to make a folder Personal containing another folder, say Fun, then call your new folder Personal/Fun." (ok, it's not pretty clear, but when you understand what it's trying to say to you, it's clear).

Note that the cache maintained on the client side actually looks like what you think it should look like, with each mail folder being its own directory.

Considerations on the Unix IMAP Server mailbox format

In an ideal world, you shouldn't need to worry about what format the Unix IMAP server maintains your mail. However, there are two things that can happen in the real world that make it less than ideal. First, you may wish to access your IMAP mail from more than one mail client "virtually simultaneously." By this, I mean that you've got more than one mail client that you like to leave running -- and you'd really like it if both saw the same thing vis a vis your mail, and neither interfered with the other. The second thing that can happen is that your mail folders may get large -- eg, megabytes of inbox for example.

In either case, you'll find that the default "real world" settings of CSE's IMAP server are not quite what you would like. By default, IMAP stores mail in standard Berkeley mbox format. This is the format made famous by programs like /usr/ucb/mail and from... basically, a mailbox is a collection of messages, with each message delimited by a blank line followed by a line starting with "From." Pretty simply, for sure, but it creates problems with concurrent access (doesn't work so well -- one or more of the concurrent clients generally fails without generating an error at the mail reader), and performance when files get big.

An alternative (that is, better) solution is to use the ".mbx" format which, without getting technical, supports concurrent access and performs better. See this report for a more detailed description on the various mailbox formats."

Fortunately, UW CSE's IMAP server is able to handle mailboxes in either the Berkeley mbox or .mbx format. By default, it uses mbox. You can tell it, on a mailbox by mailbox basis, to use the other format. There are two elements to this conversion:

Presently, on hugh.cs.washington.edu, you can find a copy of mailutil in Jan Sanislo's directory: ~oystr/Mbx/mailutil. Or, you can use this version on many Linux machines. Or, you can find a likely up to date copy on google -- look for "imap mailutil linux" for example.

Converting over existing mailbox files

The first thing you will want to do is convert over your mbox to .mbx format.

FIRST, GO TO EACH AND EVERY CLIENT MACHINE WHERE YOU HAVE AN IMAP CLIENT RUNNING AND KILL IT. DO NOT ATTEMPT TO DO ANY OF THIS CONVERSION WHILE YOU ARE RUNNING A CLIENT.

NOTE: You may choose to make a copy of your mbox first -- don't forget to delete the copy once everything's working!

Assuming you have mailutil in your path (if not, specify it with the appropriate path), run the following from the command line ON THE MACHINE WHERE YOUR IMAP MAIL IS STORED (eg, the SERVER MACHINE -- do NOT run this on your Mac):

cd     
mailutil copy mbox '#driver.mbx/INBOX'
This says "cd to my home directory, and convert over mbox to a file called INBOX which is in .mbx format." Don't get hung up on the syntax. It's irrelevant. And you only have to do this once in your whole life.

Once you've done this, you should have a file called INBOX in your home directory. It is in .mbx format. You can verify that it's ok by starting up a mail client somewhere and having a look at your inbox. You should notice a couple of things -- first, it's much faster to refresh, access, etc. Second, once you come in from a second client at the same time, mail that shows up in one place shows up in all.

Now that you're feeling pretty good about converting over your mbox file, you can go ahead and convert over each of your mailbox folders. You don't have to do this, but there's really no reason not to.

OF COURSE, REMEMBER TO KILL ANY MAIL CLIENTS BEFORE YOU DO THIS.

For each mail folder (really, big flat file) living in some directory, say dir1/dir2, you convert it over as follows:

mailutil copy dir1/dir2/folder '#driver.mbx/dir1/dir2/folder.mbx'
mv dir1/dir2/folder.mbx dir1/dir2/folder
That is, the first command says "please reformat my mail folder and leave the results in a file ending in .mbx" and the second says "please make the .mbx formatted folder the one that the mail client sees."

As before, you may want to back up your mail before you try this just in case.

If you've got tons of mail folders, you might want to run write a little shell script to do this.

Creating a new folder in .mbx format.

By default, when you create a new folder from the Mac mail client, the IMAP server puts in Berkeley mail format. To force the folder (say "Jokes") to be created in .mbx format, specify its name to the Mail client as:
#driver.mbx/Jokes
This will show up in your UI as a folder named "Jokes", but it will have the right (.mbx) format.

One last word

Rumor is that the .mbx format doesn't interact well if you use a .maildelivery or .procmail filter on your Unix machine before mail arrives. I've not confirmed this rumor, but have respected it by eliminating any automatic mail processing. This is a little inconvenient, so if somebody wants to experiment and let me know, I can upgrade or downgrade the rumor as necessary.

Copyright 2003-2004 Brian Bershad