![]()
Linux for Newbies, Part 9:
"You have mail"
by Gene Wilburn
(The Computer Paper, April 2000. Copyright © Wilburn Communications Ltd. All rights reserved)
"You have mail" and "You have new mail" are two of the commonest messages that greet you when you log in to a Linux system. Email is, arguably, the most important service offered on the Internet. Despite the ravages of spam, overactive mailing lists, and general inbox glut, person-to-person communication with anyone in the world connected to the Net remains one of the most compelling reasons for getting an ISP account. Email ranks alongside the World Wide Web as one of the twin pillars of modern technological existence.
Email is also one of the oldest services. There was email and file transfer (FTP) from the earliest days of the Internet and email even precedes the development of the Internet itself. Not surprisingly, given that the Internet was developed primarily on Unix systems, there is a rich heritage of mail readers available to Linux and Unix users.
The basic breakdown of Linux email packages is text vs. graphical. Text-based email readers have been around since the beginning. Linux mailers range from the barebones mail program (which is not as barebones as it looks once you peer under the hood) to graphical mail readers such as Kmail and Netscape Communicator. What type of reader you use is largely a matter of preference or religion. Let's begin by looking at the text-based readers.
The mail program
When you install Linux (this series is based on Red Hat Linux 6), you get a command-line mailer as part of the base install. The program is called mail. These days mail is used mainly for sending mail from the command line or from scripts. For instance, you can jot off a quick message to someone (if you're connected to the Internet) by typing:
$ mail someone@somewhere Subject: How about lunch? If you have time for lunch today, give me a ring. . Cc: someoneelse@somewhereNotice the "dot" on the next-to-last line. On most systems a dot on a line by itself in mail is an end-of-message indicator. The message is sent as soon as you hit RETURN at the Cc: prompt (you can leave Cc blank).
You can also use the command line to send a file as a message, such as a program file or configuration file:
$ mail -s "This is how our inetd.conf looks" \ > someone@somewhere < /etc/inetd.confIn Linux you could either type the above as one long line that wraps around on the screen, or break the line into readable segments using the backslash "carryover" symbol, as in the preceding example. Note that the "-s" flag can be used to put a subject line on the message.
The mail program in Linux can also be used as a mail reader--somewhat primitive, but surprisingly useable. Just typing "mail" will bring up a screen of your Linux Inbox listings:
Mail version 8.1 6/6/93. Type ? for help. "/var/spool/mail/gwilburn": 131 messages 3 new 121 MOOREPW@gov.ns.ca Fri Feb 4 13:42 58/2190 "Stan Rogers submissio" 122 dugimac@sympatico.ca Fri Feb 4 16:34 76/2925 "[mplpost] Musi-Cal te" 123 arhyno@server.uwinds Fri Feb 4 18:39 39/1425 "Re: SC2000 Session" 124 support@iprimus.ca Fri Feb 4 23:14 171/7893 "Important Notice - Se" 125 dugimac@sympatico.ca Sat Feb 5 08:52 70/2631 "[mplpost] Re: Festiva" 126 MAILER-DAEMON@cyberu Sat Feb 5 08:57 95/3616 "Returned mail: Local " 127 sam4567@mailcity.com Sat Feb 5 10:19 412/14963 "NEWS ALERT - SPECIAL " 128 dcentexp@onlink.net Sat Feb 5 11:09 69/2416 "Picking your brain" >N129 writer@kingston.net Sat Feb 5 12:36 64/2651 "[mplpost] Five thousa" N130 gene@wilburn.ca Sat Feb 5 12:43 14/488 "How about lunch?" N131 gene@wilburn.ca Sat Feb 5 12:48 103/3819 "This is how our inetd" &The ampersand is the mail prompt. If you enter a message number, it displays the message on screen:
& 130 Message 130: From gwilburn Sat Feb 5 12:43:52 2000 Date: Sat, 5 Feb 2000 12:43:52 -0500 From: gene@wilburn.ca To: gene@wilburn.ca Subject: How about lunch? If you have time for lunch today, give me a ring. &You can switch from message to message, send replies, move messages to another mailbox, invoke your favourite text editor, run a spell check, scroll backwards and forwards, set how many lines of display, etc. All this information is in the man pages. Type "man mail" to find out all the options.
I'm including mail in this column because it's on every system, it always works, it's very useful in system scripts, and getting to know it gives you another admin tool that is a portable skill to other Unix systems.
Upscale Text Readers
Linux mail is an example of the oldest kind of command-line-oriented reader -- useable, useful, but a bit annoying to deal with on a daily basis. It didn't take long for Unix hackers to come up with something nicer. Along with the advent of full-screen editors, such as vi, came full-screen mail readers, such as Elm. Elm, which stands for ELectronic Mail for Unix, provided the ability to scroll up and down the message screen, read a message by tapping the ENTER key, replying by typing "r" or forwarding by typing "f", delete with "d" and undelete with "u". Elm is fast, stable and still used by many people. It is normally installed by default on a Red Hat system. Typing "man elm" will provide details on using Elm, including how to send command-line messages with it.
Pine may be the best known, and most widely used, of the text-based, full-screen mailers. Pine was designed to be a better Elm than Elm and the name Pine itself is an acronym for "Pine Is Not Elm"--one of those self-recursive acronyms such as GNU (Gnu is not Unix), that Unix programmers are so fond of. Lately the Pine maintainers have revised history to say that Pine stands for "Program for Internet News and Email" but this new corporate button-down name is not nearly as creative or as much fun.
Pine is a feature-rich program that has been kept up to date very nicely. It can now read HTML-based messages and it can be configured to start up a Web browser such as Lynx for http links. With its visible help menus, it is easy to use and likeable. One of its best features is its built-in editor, Pico, which makes composing messages easy for new users. Pico, as we saw in a previous column, also makes a very good standalone general editor for Linux itself.
The best way to get to know the advanced features of Pine is to type "S" for Setup, and "C" for configuration from the Pine main menu. At each configuration option, type "?" for additional information. If you like text-based mail readers, Pine may suit your needs perfectly. Pine is intalled by default on Red Hat systems.
If you're a tinkerer and want almost total control over how your text-based mail reader looks and acts, Pine might be just a bit too tame for your tastes. You should consider Mutt. Mutt is highly configurable and Mutt aficionados have made all kinds of interesting Mutt configuration files available on the Internet. Mutt, too, is installed by default on Red Hat systems. Check "man mutt" for additional information.
GUI Mailers
I'm personally so fond of character-based mailers that I use them even while I'm in X, but I can understand how users who started their Internet lives on Windows or Macintosh systems might find them a bit quaint. Linux, as they say, is about choice, and your choice of a mail reader is your own business.
If you're new to Linux, or frequently move between Linux and Windows, you can use one of the most popular mail readers around: Netscape Communicator. Communicator offers a well-designed GUI interface that includes sizeable, movable panels and "drag and drop" of messages into folders. It offers POP and IMAP connections to your ISP and, naturally, displays HTML messages well (although you should be aware that HTML email is frowned upon in the Unix world). Its Address Book features can be ported between Linux and Windows or Linux and Mac environments. URL links inside mail messages are just a click away.
Communicator is a decent mail reader overall, but it lacks the panache of programs usually associated with Unix. Therefore it's no surprise that many Linux users seek out something a bit more native to the environment.
To be honest, a few of the native graphical mail readers look like exercises in X Window programming. A case in point is a reader called XMailTool. Clearly designed around X Window widgets, it is fast but has little aesthetic appeal.
Two mail readers based on the Tk X Window widget set are more generally useable. If you are running a lightweight windows manager such as FVWM or IceWM, you may find TkMail or Tkrat a good match. Both are fast and have pleasant interfaces. TkMail, a simple mailer, has all the basics: send, reply, include message (quoted), Cc and Bcc, and MIME attachments. It allows you to adjust the views in several ways, from sort order to fixed-font display. TkMail is utilitarian, lightweight, and a good demonstration of how useful the Tk widget set is for simple GUI development.
TkRat is a Scandinavian product. The Rat in TkRat stands for Ratatosk (swift tusked), the squirrel in Norse mythology that runs up and down the cosmic tree, Yggdrasil, carrying abusive language from the dragon Nidhog at the bottom of the tree to the eagle at the top of the tree, and vice versa. Definitely not your ordinary mailer.
Among its advanced features, TkRat allows you to create a database of mail messages, assigning keywords to them for quick lookup. It also has a delightful feature called "Take mail from Netscape" which "Looks for messages which Netscape has taken from your inbox and steals them back (to your inbox)." TkRat is usually installed by default in a Red Hat setup.
If you're using KDE, then you'll likely want to explore Kmail, the K Desktop mailer. Kmail is a modern mailer with plenty of options. You can use it to check the mail of multiple POP accounts and it has built-in "rules" or filters that can be applied to incoming messages.
As with most KDE applications, Kmail is accompanied by an HTML manual that provides extra documentation. Kmail is a slick application with a nice appearance. The only thing it lacks, for my taste, is a "long line wrap" option that will take those one-paragraph-per-line messages and wrap them on screen. Netscape Communicator has this feature. With Kmail, you have to scroll and scroll to the right, losing the context of the earlier part of the paragraph. Once this feature is added, Kmail will be a serious challenger.
Next time: Finding things on a Linux system
Gene Wilburn (gene@wilburn.ca) is a Toronto-based IT specialist, musician and writer who operates a small farm of Linux servers.
-30-