Configuring Your E-mail Client

This month, let's talk about e-mail. E-mail really is a huge subject, and there are lots of books written about what it is, how it works, and the underlying software involved. Luckily, as a newbie, you don't need to know about most of the information contained in those books. For now, we'll leave the details to the gurus and just cover some of the basics.

This month, let’s talk about e-mail. E-mail really is a huge subject, and there are lots of books written about what it is, how it works, and the underlying software involved. Luckily, as a newbie, you don’t need to know about most of the information contained in those books. For now, we’ll leave the details to the gurus and just cover some of the basics.

Basic Overview of E-mail

E-mail is one of the first applications that emerged from the development of the Internet. It started out as a way to send messages between users on the same computer or on two or more computers. When it comes right down to it, e-mail hasn’t really changed a lot since its inception. Some advancements have been made, of course, and we’re now able to send video, audio, graphics, and any other conceivable type of file along with our simple messages. For the most part, however, we’re still using the same basic technologies that the original hackers used. E-mail is still considered the “killer app” of the Internet.

Most of us don’t have permanent connections to the Internet or to our ISP (Internet Service Provider); we dial in to our ISP when we want to send or receive our mail. What this means is that when someone sends you e-mail, it arrives at your ISP and has to sit there and wait until you call in to pick it up. The mechanism for this, and where the e-mail sits at your ISP, isn’t important to you. You dial in to your ISP and start up your mail program. Somehow, the mail is copied from your ISP to your computer, and the ISP’s computer then deletes its copy. There are other configurations, of course, but this is the most common. For those of you with more permanent connections to your ISP, the mechanism is basically the same.

When you send mail, the process is similar. You may compose your mail “offline,” while you are not connected to your ISP. The mail sits somewhere on your computer until you dial your ISP. The mail is then copied from your computer out into the world, and deleted from that “holding” area on your computer.

Configuring Pine

Pine is a hybrid mailer that can work with sendmail or on its own without any MTA. Pine has more options than you can imagine, and so setting them all is no trivial task. Fortunately, to get Pine to work you can stick with most of the defaults and change just a few values.

Start up the mailer with the command pine. You’ll see a menu of commands with the character to type to make a selection, the command name, and a short description. A typical menu selection is:

S SETUP – Configure Pine Options

Pine also shows you a status bar at the bottom of the window with more command selections. You can use the up- and down-arrow keys to move to your menu selection, and then press Return, or else you can type the command letter to jump directly to the command you want.

For example, type s for setup, then c for configuration. Pine will now display the configuration options. There are several pages of options. You can move around with the up- and down-arrow keys to get to the options that you want to change. As an option is highlighted, the instructions at the bottom of the window will show you the choices you can make. To get the basics of Pine set up, the options you should fill in are: personal-name (your full name), user-domain (your ISP domain name), smtp-server (the name of your ISP’s SMTP server), and inbox-path (/var/spool/mail/login-name). When you’re finished with the configuration, type e to exit setup, then y to save your changes.

To cover Pine setup in detail would take much more space than I have available here. These basics should get you started. The Pine “HELP” option is an excellent source of information.

Some of the Gory Details

If you’re not interested in the down-and-dirty arcana involved with e-mail, you’ll probably want to skip this section. These details are useful when you need to know how e-mail works, but if you just want to get going with the practical side of e-mail, then leave this section for some time when you have trouble sleeping.

Two fundamental components are involved when you send and receive e-mail: the Mail Transfer Agent (MTA) and the Mail User Agent (MUA). The MTA is responsible for sending and forwarding e-mail, or “transferring” it. The MUA is the component that allows you, the user, to read and write e-mail on your machine.


Newbies LinuxConf 4
Figure 1: linuxconf.

sendmail takes care of delivering mail from your computer to the outside world. Delivery may be to the recipient’s ISP, directly to the recipient, or to your ISP (who will forward it). The exact details depend on a number of factors, but generally speaking those don’t affect you for now.

The sendmail configuration file is named /etc/sendmail.cf. This file contains the rules sendmail uses when delivering or routing e-mail. The language used to create these rules is very complex, and you probably shouldn’t mess around with the sendmail.cf file unless you really know what you’re doing. There are some very good books available that cover the various complexities of sendmail, some of which are listed at the end of this article. Chances are that the sendmail.cf file that was installed with your Linux distribution is already set up to do everything you need it to do. For now, I recommend that you don’t mess around with it at all. sendmail is one of those things that even gurus find a bit intimidating, so best leave it to them for the time being.

If you do run into problems that you think might be related to sendmail, however, there are a couple of commands you can use to help track down problems. Typing mailq on the command line will examine the mail queue and tell you if there are any messages waiting to be delivered. The sendmail -q -v command will tell sendmail to try to deliver any mail that is waiting, printing the resulting SMTP dialog to the screen. This information might be difficult to interpret, but it may give you a hint as to what problems sendmail encounters when attempting a delivery, if such problems exist.

In some cases it might just be that your sendmail.cf file is not correct. If this happens, there is a fair bit of help available on the Internet. The www.moongroup.org site contains some very explicit instructions at http://www.moongroup.org/how-to.phtml. If that doesn’t do the trick, you should pick up one of the sendmail references mentioned at the end of this article.

If you are using the Red Hat Linux distribution, you should try using the linuxconf utility (Figure 1) to make any changes to your mail delivery system before attempting to edit the sendmail.cf file by hand. The relevant information in the linuxconf utility can be found under “Mail delivery system,” then under the “Basic” and “Basic Information” menus. When you make changes and click “Accept,” linuxconf will ask your permission before rebuilding the sendmail.cf file. Assuming that you want to make these changes, you must allow it to do so before these changes will take effect.

Mail Transfer Agents

The most common MTA (which is included with most Linux systems) is sendmail. sendmail usually runs in the “background” on your computer, meaning that it is there, happily doing its job, without having any obvious interface through which you need to watch or to interact with it. Background processes such as this are generally known as “daemons.”

sendmail is a very complex piece of software, and for good reason. While sendmail can be used as your personal MTA on your desktop or laptop Linux system, it is also used on the largest computers and networks, handling the routing and delivery of e-mail for thousands of users. sendmail is used at many (if not most) ISPs, since it is the most popular MTA currently in existence.

Configuring sendmail is not a task for the faint of heart. In fact, it’s a job best left to gurus and pros. There’s a file on your computer called sendmail.cf (usually in the /etc directory). Whensendmail starts up (usually when your machine boots), it reads this file, which contains the rules it will use when delivering or routing e-mail. The language used to write these rules is very complex, and for this reason many people don’t like sendmail. sendmail does an excellent job, however, and most Linux distributions come with a sendmail.cf file that you shouldn’t have to change or modify unless you really need to do some more advanced e-mail trickery.


fetchmail is a program that retrieves your e-mail from a remote computer and stores it on your local machine. Mail retrieved with fetchmail is stored in such a way that you can use any mail client to read it. fetchmail can be used with any mail server that is POP3, IMAP, or ETRN-capable, and it can be run from the command line, through the cron utility, or as a background daemon.

To use fetchmail, you have to create a file called .fetchmailrc in your home directory. When fetchmail runs, it reads this file to get the information it needs to retrieve mail from one or more remote mail servers. A basic .fetchmailrc file looks something like this:

poll mail.myserve.com protocol pop3 username jack
password foob@R nokeep

poll myothermail.com protocol imap username jack
password f00b@r nokeep

Each line contains the same basic information, and there is one line for each server from which you want to retrieve mail. Here’s a quick explanation of the first line:

* poll mail.myserve.com This tells fetchmail to check for mail on the server named mail.myserve.com.

* protocol pop3 Tells fetchmail which protocol to use when talking to that mail server. If you leave this directive out, then fetchmail will try the ones that it knows about until it finds a protocol that works. If you know what protocol your ISP uses, then you can save fetchmail some time and trouble and tell it here.

* username jack password foob@R Tells fetchmail which username and password to use when establishing a connection to the server.

* nokeep Tells fetchmail to delete messages from the server once they have been copied to your local machine.

Naturally, you have to modify this to use the information appropriate to your mail server.

Once you have created a .fetchmailrc file, you have to change what the permissions are on that file using the chmod command. The file must be readable only by you, the file owner. Set the permissions with the following command:

chmod 710 .fetchmailrc

When the permissions have been changed, you can start fetchmail from the command line. I recommend you read the fetchmail man page (man fetchmail) to see what options are available. For example, if you want to see what fetchmail is doing, type fetchmail -v on the command line. If you just want to see if there is mail on the server, but you don’t want to retrieve it, use fetchmail -c.

For more information about running fetchmail as a background daemon, read the fetchmail man page. To use the cron utility, I suggest you read the cron man page.

Mail User Agents

Mail User Agents are what we think of when we talk about e-mail clients. They are the software programs that allow you to read, write, sort, print, and do other things with your e-mail once you have received it. A number of different e-mail clients are available for Linux, and more are being developed all the time.

Some of the most popular Linux e-mail clients are Pine, Elm, the client that is part of the Emacs editor, Netscape Messenger, and Kmail (the KDE e-mail client). Netscape Messenger and Kmail are actually MTA/MUA hybrids, in that they handle both mail delivery and routing functions. Pine also has this ability.

After you write and send an e-mail message, it usually sits in a mail queue on your computer in a directory named /var/spool/mqueue. When your computer is connected to the Internet (be it immediately or later when you dial up and log in to your ISP), the sendmail program on your machine establishes a connection and communicates with the MTA on your ISP’s machine. The language used during this communication is quite likely to be the Simple Mail Transfer Protocol (SMTP). The e-mail that is sitting in your mail queue is examined and delivered when this connection is successfully established. The MTA on your ISP will then either pass each e-mail along to another MTA on another computer, or it will deliver the e-mail directly to its intended destination.

When you receive e-mail, things work a little differently. Where you used SMTP to send mail out from your computer, you will use a different protocol to bring mail into your computer. These days, most e-mail is retrieved using the Post Office Protocol (POP). Other protocols are available, but POP is the most common.

One program that you can use to retrieve your e-mail is fetchmail. You can run fetchmail either from the command line or as a background daemon. When fetchmail runs, it creates a connection with the server on which your mail is stored, and your e-mail is retrieved via that connection using whichever protocol you specify.

When fetchmail retrieves your mail, it stores it locally in the /var/spool/ mail directory until you fire up your MUA (Elm, Pine, what-have-you). The client moves the mail from where it is stored into one or more local “folders” or directories, usually in your home directory.

If you use Netscape Messenger or Kmail, on the other hand, you don’t need to use a program like fetchmail, because the software needed to retrieve your mail from the remote server is incorporated into these clients.

When you tell Netscape Messenger to get your mail, it first creates a connection in much the same way fetchmail does, and then retrieves your mail through that connection and stores the mail into the local folders. The step in which your mail is stored in /var/spool/mail is not necessary when you’re using an integrated MTA/ MUA package like this.

Newbies MimePic 1
Figure 2: A MIME message. E-mail the Easy Way and the Less Easy Way


Back in the “good old days,” e-mail consisted of text and only text. Today, e-mail still consists mostly of text (usually sent and stored in plain ASCII), but as e-mail grew in popularity, so also grew the demand that it be able to include images and other types of files.

The solution that was developed to enable the transferring of files via e-mail is MIME, which stands for Multipurpose Internet Mail Extensions. Some mail clients have to be specially configured to send or receive MIME-encoded messages. These configurations are usually quite easy to set up, but they’re beyond the scope of this particular article.

If you read your e-mail and see something that looks like Figure 2, what’s happened is that you have received a MIME-encoded message, and your e-mail client is not set up to handle it properly. The documentation for your client should tell you how to correct this.

The easiest way to begin sending and receiving e-mail is to use one of the programs that combines both an MTA and an MUA. Netscape Messenger is an integrated part of the Netscape Communicator program, and Kmail is included with the default installation of the K Desktop Environment (KDE). See the Configuring Netscape Messenger and Kmail sidebars for information about configuring these programs.

Configuring Netscape Messenger

Newbies NetscapePref 5
Figure 3: Netscape mail preferences.

Configuring Netscape Messenger is quite simple. In Netscape, select the “Preferences” option in the “Edit” menu. This brings up the Netscape preferences dialog box. In this, select the “Mail & Newsgroups” menu (Figure 3), then click on the “Identity” option. The right pane of the dialog box will change, and it will contain a form in which you can specify your name, e-mail address, and your e-mail return address.

Next, highlight the “Mail Servers” option. Put the name of your SMTP server (likely provided by your ISP) in the “Outgoing mail (SMTP)” field. Also fill in the appropriate username for that server if your ISP requires this.

Newbies NetscapeIncoming 6
Figure 4: Netscape incoming mail preferences.
Click the “Add…” button to enter the information Netscape needs to retrieve your incoming mail (Figure 4). Put the name of your incoming mail server in the “Server Name” field, select the appropriate protocol (probably POP) from the drop-down list box, and fill in the “User Name” field. You can also select checkboxes to tell Messenger whether or not it should remember your password (if you select this, it will ask for your password only the first time it attempts to retrieve mail), whether it should check for mail at a specified interval (which is useful only if you’re online more often than not), and whether new messages should automatically be downloaded. Don’t worry too much about these checkboxes right now. You’re likely to come back and change these back and forth quite a bit until you find a configuration that works well for you.

If you select the “POP” tab at the top of the dialog, you can tell Messenger whether it should leave a copy of messages on the server after it has retrieved copies to your local machine. Under most circumstances, you will want to leave this box unchecked.

If you’re not a fan of e-mail clients with fancy graphical user interfaces, or if you would just like to experiment with other mail clients before deciding which is your favorite, you’ll have to do a bit more work than with Netscape Messenger or Kmail.


Newbies Kmail Setup
Figure 5: Kmail setup.
Kmail is the mail client that comes with the K Desktop Environment (KDE). Kmail can be used with sendmail and fetchmail, or it can be used alone to send and receive e-mail. You don’t have to be running KDE to use Kmail, as long as you have the correct Qt libraries installed. Many Linux distributions include the most recent Qt libraries by default, but if you’re unsure, you should read the documentation that came with your distribution to be sure. If you don’t have the Qt libraries installed, you can download and install them separately.

Assuming that you have both the Qt libraries and Kmail installed, you can start it from the command line, or, if you are running KDE, you can launch it from the main KDE menu. Once Kmail is running, select the “Settings” option in the “File” menu. This will launch a setup dialog box (Figure 5) where you specify the information Kmail needs to send and retrieve your e-mail successfully.

On the “Identity” page, fill in your name, e-mail address, and return address. Next, select the “Network” tab. If you use an SMTP server for outgoing mail, click the “SMTP” button and add the name of that server to the appropriate field.

Under “Incoming Mail,” click the “Add…” button. This will bring up another dialog box where you can fill in the server name and your login information. There are also a number of checkboxes in this dialog, all of which should be self-explanatory.

To use an independent mail client such as Pine, Elm, or the Emacs mailer, you will have to make sure that sendmail and fetchmail are both configured properly on your machine. As mentioned earlier, sendmail is a common MTA, and fetchmail is a program that retrieves your mail from a remote server. Once these are configured, you can experiment with any of the mail-client software that comes with your Linux distribution.

Newbies ElmPic 2 Newbies PinePic 3
Figure 6: Elm: Stable but old school. Figure 7: Pine: A popular text client.

Elm (Figure 6) is an MUA that has been around for many years. It isn’t as popular these days as some of the newer MUAs, so development on it has for the most part stopped. It is very stable, though.

Pine (Figure 7) has also been around for a long time, is pretty simple to learn, and remains among the more popular text-oriented mailers. Pine is a hybrid in that it can serve as both MUA and MTA if you want.

Whichever program you decide to use, sending and receiving e-mail on a Linux system is quite simple. Configurations may vary, but the fundamental ideas are the same.

More on Mail

Barkakati, Naba. Red Hat Linux Secrets. IDG Books Worldwide, 1998.

Costales, Byran and Allman. Eric. Sendmail. O’Reilly & Associates, 1997.

Koffler, Michael. Linux: Installation, Configuration, and Use. Addison Wesley, 1999.

Hal Moroff has been developing UNIX systems and applications for 20+ years. He’s new enough to Linux that he’s finding new things every day. He can be reached at halm@ieee.org.

Comments are closed.