Setting up Mutt
Mutt is a Mail User Agent (MUA). The mail user agent sits on the mail server machine and provides an interface to e-mail for users who have ssh'd in. If you're going to provide your users access to their mail while on the machine (versus through IMAP or POP3), you'll probably need an MUA.
I recommend mutt, which can be installed with apt-get install mutt.
Mutt with mbox Format
If you set up exim to use the mbox format, you should be good to go. Become a user with e-mail and type mutt. At this point, if you've updated DNS, you should be able to send and receive e-mail. (The mail you access with mutt without arguments is stored in /var/mail/username.)
When a user closes mutt, they'll see a prompt to move read mail. Mail that's read gets moved to ~/mbox, so to read old mail that has been moved here, users must execute mutt -f mbox. Similarly, sent mail is stored in ~/sent.
Mutt with Maildir Format
Since Mutt assumes you're using mbox by default, it needs to be configured and told otherwise. Users must have an individual file in their directories to override this. First of all, as a user other than root, copy over the built in Debian example with
zcat /usr/share/doc/mutt/examples/sample.muttrc.gz > ~/.muttrc
zcat automatically gunzips the file. Go ahead and take a look at this file. Notice the last line of the file points to
another file, ~/.muttrc-local. You can either add the following commands to that file, or replace the line pointing to the commands with these following commands themselves. I'm going to go with the first route and add the following lines directly to .muttrc; if you choose to add them to ~/.muttrc-local, then make sure later on when I talk about copying .muttrc, you also copy .muttrc-local.
set mbox_type=Maildir set folder="~/Maildir" set mask="!^\\.[^.]" set mbox="~/Maildir" set record="+.Sent" set postponed="+.Drafts" set spoolfile="~/Maildir"
Troubleshooting Maildir Format
Make sure this works by trying running mutt as one of your users. If you receive an error something like this,
Error in /home/kwanous/.muttrc, line 339: dset: unknown command source: errors in /home/kwanous/.muttrc
it usually means you have a typo in your file, so check around the line number it lists to find the error. On the other hand, if you receive this error:
Error in /home/kwanous/.muttrc, line 346: /home/kwanous/.muttrc-local: No such file or directory source: errors in /home/kwanous/.muttrc
you probably put your new commands in the .muttrc file like I did, but you forgot to delete the line that says
source ~/.muttrc-local # config commands local to this site
If you want this to take affect for all of your users, you're going to have to copy it over to each user's home directory, and then make sure that each new user gets a copy of this file.
Copying .muttrc to Current Users
I wrote a small bash script to do this. Copy this file over to your machine and change it to executable (chmod +x script.sh), then run it from a directory that has the correct .muttrc file. This script requires you to run it as root.
Copying .muttrc for New Users
To make sure any new users added receive the .muttrc file, place a copy of it in /etc/skel. Any files located here are automatically copied over to a user's home directory when adduser is executed. Run this command as root:
-
cp .muttrc /etc/skel