FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.
Knowledgebase: Email
Reading Mail on the Server from the Command Line
Posted on 21 November 2003 04:52 AM

For accessing your FutureQuest® hosted email accounts when away from your usual computer, FutureQuest recommends using the QuestMail webmail interface.

This tutorial is for advanced users only, who are familiar with the Unix command line, and provides an option to read and send email via a command line session (SSH) rather than a web interface. The FutureQuest Service Desk is unable to provide direct support for IMAP or for the use of Mutt. Please direct any requests for help in these areas to the FutureQuest Community Forums.

FutureQuest has installed the Mutt email client on all of the Community Servers. This is a brief tutorial to get you started using Mutt with IMAP protocol.

The following topics are presented below:

Setting Up Mutt for IMAP Access

To set up your account to use Mutt, you will need to create a .muttrc file. This is the configuration file for Mutt. Place this file in your HOME directory, i.e. the /big/dom/xdomain/username directory, with the path modified appropriately to correspond to your own account.

You must use a text editor to create your .muttrc file, or you can use the File Manager in your CNC to create the file directly on the server. At a minimum, you will need to include the following information in the .muttrc file, one setting per line, replacing "example.com" with your actual domain.tld and replacing "accountname" with the name you use for logging into your POP account. For older accounts on shared IP addresses, don't forget to use the VMIP attached to the front of your POP account name. (Alternatively, you can just use the full email address as the username for accounts on either shared or dedicated IPs.) Make sure to copy the settings exactly (except for modifying your own account particulars), using the same upper- or lowercase, as shown, and exactly the same spacing and punctuation marks.

Minimum settings for .muttrc file (change italicized text to your account's particulars):

set imap_user="accountname"
set spoolfile={pop.example.com}Inbox
set folder={pop.example.com}Inbox
set from="myemail@example.com"

Note that the setting for "from" is the email address which is shown in the From field of the email header. Set it to your own email address so that you will be able to receive any bounce notices or replies to emails you send from Mutt.

Place the .muttrc file in your HOME directory. Make sure that if you have created the file on your local computer and then uploaded it to the FutureQuest® servers, that you upload it in ASCII (text) mode.

Using Mutt for Reading Email

With the .muttrc file in place, as described above, you have the minimum configuration needed to begin reading email using Mutt on the FutureQuest® servers. To open your Inbox and begin reading emails, simply type 'mutt' at the command prompt, without the quotes, making sure to use all lowercase letters. Mutt will now prompt you for the password to your email account. If you do not get a password prompt, or if you receive some type of error message, either you entered the command incorrectly or there is some problem with the .muttrc file. For problems with the .muttrc file, double check the entries in the file, make sure the file was uploaded in ASCII mode, and double check the name of the file. The file name must begin with a period, have all lowercase letters, and have no other file extension appended to the end.

After you enter the password, Mutt will display a list of messages in your Inbox. The Inbox index screen looks something like this:

To navigate to a particular message, use the up and down arrows on your keyboard. Once you navigate to a particular message, you can read that message by pressing the space bar. To exit out of the message and return to the Inbox index, enter the 'i'-key. Notice that Mutt displays some menu commands across the top of the screen, and extensive online help is available by entering the question mark (?) key, from almost any screen.

Composing and Sending Email

To compose and send an email, Mutt uses an external editor. You must be familiar with some Unix text editor installed on the FutureQuest® servers or you will be unable to compose and send email in Mutt.

The available text editors are: vi, emacs, ed, Pico and Midnight Commander.

Vi and emacs are very powerful, but rather complicated to use. If you are not already familiar with these editors, you will not want to use them. Pico is a simple text editor, and you may familiarize yourself with its basic functionality in our Pico tutorial.

When composing a message to send, Mutt will exit to an editor shell where you type the message. The default editor is vi. If you do not specify an alternate editor in your .muttrc file, Mutt will shell out to the vi editor. To specify your editor preference, add the following setting to your .muttrc file, substituting the appropriate path information:

set editor=/full/path/to/editor

To set your editor to Pico, for example, you would add the following line to your .muttrc file:

set editor=/usr/bin/pico

To compose a new message, use the 'm'-key. You will be prompted for the email address of the recipient and the subject of the message, after which Mutt will shell out to your preferred editor interface. Compose your message in the editor and then exit and save your message to the temporary file name that Mutt suggests. For example, if you are using Pico, exit by typing ^X (Ctrl-X) and then type Y to save your message. Press enter to save it to the temporary file name that Mutt suggests.

Mutt now brings you to a screen where you may specify additional message options, which looks something like this:

Use the 'y' command to send the email. Other commands are shown across the top of the window, or use '?' for Help.

Additional Configuration Options

In order to control the appearance of your sent email, or further fine-tune the behavior while using Mutt, you may want to set additional options in the .muttrc file. We suggest a few here. Note that if you modify the .muttrc file that you will need to close down and start Mutt again in order for your changes to the .muttrc file to take effect, as these settings are only loaded when Mutt is first started up.
(Note: The system default settings are in /etc/Muttrc and the settings in your personal .muttrc file override the system defaults.)

  • hostname: Use this option to control the domain used for Message IDs and the domain part of local email addresses, replacing "example.com" with your domain name.

    set hostname="example.com"

  • realname: Use this option to set the "Real Name" part of the From email address field which is used when composing and sending new email:

    set realname="John Q. Adams"

  • signature: You can set up Mutt to include a default signature in all emails you compose. The default value for the signature file is "~/.signature" which is a file named .signature in your HOME directory. To use the default file name, you need not add any lines to your .muttrc file. Simply create a file named .signature with the desired signature content and place the file in your HOME directory. If you wish, however, to use a different file name for the signature file, for example if you have more than one account set up for using Mutt, you can override the default file name with this option. The example setting below will instruct Mutt to look in the file mysigfile.txt for the signature contents.

    set signature="mysigfile.txt"

Using Mutt to Access Multiple Accounts

To set up Mutt to access more than one IMAP account, you will need to set up additional configuration files. Mutt configuration files need not be named .muttrc. This is simply the default name that Mutt will look for when it is invoked.

As an example, you could create a file named .muttrc-alt with configuration settings for a second IMAP account.

In order to invoke Mutt with this second configuration file, issue the following command at the command line:

[username@FQ-Server:~]$ mutt -F .muttrc-alt

The -F switch allows you to specify an alternate configuration file, other than the default .muttrc file. Every time you wish to use Mutt to access the account configured in the .muttrc-alt file, you will need to use the -F switch to specify the configuration file to use. When a particular configuration file is not specified with the -F switch, Mutt will search for the default .muttrc file, as described earlier in this tutorial.

Further Mutt Resources

Mutt is an extremely powerful and versatile mail client, and this tutorial is only a very brief introduction to using it. For further exploration and customization, you may want to check out the following resources:

The Mutt Home Page
The Mutt User Manual
The Open Directory Project's Mutt Category