Screen-Oriented Mail Programs


There are a number of screen-oriented mail programs, including elm, pine, and mutt. They are a bit harder to learn than the graphical programs, but they run on virtually any type of UNIX system (including over a remote connection). They are excellent tools for sending and receiving local mail, and they usually work without any configuration changes. They typically work best when sending plain, unformatted text, but the newer versions have gotten better at handling attachments and encoded messages. The section “Tools for Managing E-Mail,” later in this chapter, describes tools that can extend the capabilities of the screen-oriented mail programs.

elm, along with pine, used to be one of the two standard screen-oriented mail readers for UNIX. However, unlike pine, it lacks important features such as the ability to easily send attachments, and it has largely been replaced by newer programs such as mutt. This chapter describes how to use and customize both pine and mutt.

pine

pine (program for internet news and e-mail) provides a simple, screen-oriented user interface for sending and receiving mail. pine was developed as an easy-to-use mailer at the University of Washington in the early 1990s. It quickly became one of the standard screen-oriented mail readers and is still one of the most popular.

The first versions of pine were based on the elm source code, but the program has evolved extensively and now contains almost no elm code. (In fact, some people joke that pine stands for pine is no-longer elm.) pine contains an integrated text editor, called pico, which vaguely resembles a simplified emacs. The editor guides you through creating a message header and provides a simple interface to the UNIX spell command, for spell checking.

pine is in fact a very powerful mail program. It has dozens of sophisticated features, but all of them are provided as options for experienced users. Leaving these options off provides a user interface even novices can feel comfortable with. pine supports a wide range of mail protocols, including SMTP (Simplified Mail Transfer Protocol), NNTP (Network News Transport Protocol), MIME (Multimedia Internet Mail Extensions), and IMAP (Internet Message Access Protocol). These protocols allow you to send mail across the Internet, read Usenet newsgroups from the pine interface (see Chapter 10), attach multimedia files to your messages, and even access remote mailboxes as if they were on your local machine.

Getting pine

Many UNIX systems come with pine installed by default. You can also download pine for free from the Pine Information Center at http://www.washington.edu/pine/. A version of pine for Windows is also available from that site.

Reading Mail with pine

To read your mail, simply enter the pine command:

 $ pine

The first screen has a self-explanatory menu (shown in Figure 8–1) in which one item will be highlighted. You can move the position of the highlighted area with the arrow keys, and hit ENTER to select an item. Alternatively, just type the letter corresponding to your selection.

image from book
Figure 8–1: The pine menu

If you select L (for FOLDER LIST), pine will display your current mail folders, including INBOX, sent-mail, saved-messages, and postponed-messages. INBOX is a special folder that contains your new mail messages. The other folders are subdirectories of ~/mail that you can use to save messages that you send, receive, or compose.

Use the arrow keys to select a folder, and press ENTER. You will see a list of the messages in that folder. The list shows the message number, date, sender, file size, and subject for each message. If you highlight one of the messages and press ENTER, it will be displayed.

The menu bar at the bottom of each screen lists the available commands. For example, entering < will often let you go back to the previous screen. When you are done reading a message, you can use < to go back to the message list, or press the SPACEBAR to view the next message. To reply to a message, use R (if there were multiple recipients, pine will ask if you want to reply to all). To forward a message, use F. You can flag a message for deletion with D (it will be deleted when you exit pine), and you can save a message with S.

When you are done reading mail, you can use < repeatedly to return to the main menu screen. To exit pine, select QUIT from the main menu.

Sending Mail with pine

To send mail, you can either select C (COMPOSE MESSAGE) from the main menu, or you can run pine from the command line with an address list:

 $ pine rlf@library.edu

or

 $ pine dbp etch a-liu

In either case, pine will display the Compose Message screen. This screen allows you to enter the recipient’s address and other header information, and then puts you into the part of the screen where you type message text. pine uses its own editor, pico, for composing mail, although you can set an option to make it use an editor of your choice.

The menu at the bottom of the screen will change to reflect the options available while composing mail. When you use pico to compose a message, the menu at the bottom of the screen changes to this:

 ^G Get Help  ^X Send      ^R Read File ^Y Prev Pg  ^K Cut Text  ^0 Postpone ^C Cancel    ^J Justify   ^W Where is  ^V Next Pg  ^U UnCut Text^T To Spell

In each of these entries, the ^ character stands for CTRL. So, for example, you can use CTRL-K to cut a line of text, and CTRL-U to paste it. CTRL-T will check the spelling in your message. To include an attachment in your message, go to the Attchmnt field in the header, and either enter the full pathname of the file to attach or use CTRL-T to browse through your file system.

When you’ve finished entering your message, press CTRL-X to send it. The menu at the bottom of the screen changes to this:

 Send message ?              Y [Yes] ^C Cancel    N No

If you type Y or press ENTER, your message will be sent, and a copy will be stored in the “sent-mail” folder.

To exit from a mail message without sending it, use CTRL-O to save the draft for later, and CTRL-C to abandon it entirely

The pine Address Book

The pine program allows you to create an address book of the people you frequently send e-mail to. You can use these address book entries when creating and sending mail. To add entries to your address book, select the A (ADDRESS BOOK) option from the main menu.

pine brings up a screen showing you the entries in your address book. You can use @ to add new entries. Each entry has a nickname that you will use to include the address when you compose mail. It also has the e-mail address, or list of addresses. The other fields are optional.

Once you have created a list of entries in your address book, you can use the nicknames instead of typing full e-mail addresses when you compose mail. You can also use CTRL-T in the Compose Mail screen to select an entry from your address book.

Configuring pine

To view or to set options in pine go to the main menu and select S (SETUP). The next screen will display a long list of ways to customize pine (e.g., if you have a color display, you can change the colors pine uses). The most useful option here is C (Config), which will display the value of all the pine options.

There are many, many options. The list may seem overwhelming, but if you use pine often, it is probably worth skimming through all of them just to get a sense of the different options that are available to you. To view information about an option, highlight it and press ? (you can exit the help screen with E). To change an option (toggle it on or off, or add a value), highlight it and press ENTER.

Here are a few of the particularly useful options pine provides:

  • The option personal-name allows you to set your name as you would like it to appear in the address when you compose messages. For example,

     personal-name          = Jonathan (brg@turing.ca.edu)

  • To use your own editor, such as vi or emacs, when composing messages, turn on this option:

     [X]  enable-alternate-editor-implicitly

    and set the editor option to your preferred text editor, as in

     editor                 = vi

  • To cause CTRL-K to cut the part of the line after the cursor rather than the whole line, set compose-cut-from-cursor.

  • The option delete-skips-deleted causes the next message to be selected when you delete the current message.

  • Turning on enable-view-attachments makes it a bit simpler to open attached files in the e-mail you receive.

  • Often, you will receive formatted e-mail, which is more difficult to read in pine than plain text. If you turn on prefer-plain-text, pine will attempt to show you a plain text version of your mail whenever possible.

  • The option enable-exit-via-lessthan-command will cause the < command to work on screens that usually use E to go back.

  • To prevent pine from asking for confirmation when you quit, set quit-without-confirm.

  • You can assign a list of keystrokes to the option initial-keystroke-list. These keystrokes will be automatically executed by pine whenever you start the program. For example, to go directly to your message list rather than starting from the main menu, set the option like this:

     initial-keystroke-list = L, CR

    or

     initial-keystroke-list = I

  • When you compose a message in the default editor, it breaks your lines automatically at a certain length. To change the width of your messages, set the value of composer-wrap-column. For example,

     composer-wrap-column   = 70

  • Another option that you might want to consider changing is sort-key, which controls the order in which your messages are sorted. For example, you could have pine display your most recently received messages at the top of the list by selecting Reverse Arrival for the value of sort-key:

     sort-key              =             Set      Sort Options             ---  ----------------------             ()  Arrival             ()  From             ()  Subject             (*) Reverse Arrival             ()  Reverse From             ()  Reverse Subject

Remote Mail with pine

Although it is configured for local mail by default, you can also use pine to receive and send your remote mail. To download your remote mail, set the option inbox-path as shown:

 inbox-path             = {pop3.duckpond.net/user=gandalf/pop3}INBOX

where pop3.duckpond.net is the POP3 server provided by your ISP, and gandalf is your username. If the remote server uses IMAP instead of POP3, try

 inbox-path             = {imap.duckpond.net/user=gandalf}INBOX

where imap.duckpond.net is the remote address.

You can also configure pine to send your outgoing mail through a remote server:

 smtp-server             = smtp.duckpond.net/user=gandalf

Caution 

If you get the message “Unable to negotiate TLS with this server” and then enter your password, pine will send your password to the server without any encryption. This is a major security risk.

To protect your password, try enabling SSL encryption, like this:

 inbox-path             = {imap.duckpond.net/user=gandalf/ssl}INBOX smtp-server            = smtp.duckpond.net/user=gandalf/ssl

For more details about securing your password when getting remote mail with pine, see http://www.madboa.com/geek/pine-ssl/.

mutt

mutt is another widely used screen-oriented mail reader. It has many of the same features as pine, plus the ability to view your mail by threads, which has become a very popular feature. mutt may be less intuitive than pine for new users, but it is equally easy to use once you become accustomed to it. If you have used elm, then mutt may seem very familiar.

Like pine, mutt supports color displays. Unlike pine, it uses a standard text editor by default. mutt allows you to search through mail with regular expressions. It is extremely customizable, and quite fast.

Getting mutt

Many UNIX systems come with mutt installed by default. You can also download mutt (including a Windows version) for free from http://www.mutt.org/download.html.

Reading Mail with mutt

To read your mail with mutt, simply run it from the command line:

 $ mutt

When it starts, mutt will display a list of your current mail messages, as shown in Figure 8–2. The list shows the message number, status, date, sender, file size, and subject for each message. You can view a message by selecting it with the arrow keys and pressing ENTER.

image from book
Figure 8–2: The mutt mail list

The menu at the top of each screen lists a few of the available commands. Pressing ? will often print a more complete list. When you are done reading a message, you can press i to go back to the message list, or press j to view the next message. To reply to a message, use r (you can use g to reply to all recipients). To forward a message, use f. You can flag a message for deletion with d (it will be deleted when you exit mutt), and you can save a message with s. You can change the folder you are viewing by pressing c, followed by ? to browser for the mailbox file. (You can also use mutt -f on the command line to open a specific mail file.)

Entering q will often return you to the previous screen. You can exit mutt by entering q at the message list.

Sending Mail with mutt

To compose new mail, you can either use the command m, or you can run mutt from the command line with an address list:

 $ mutt rlf@library.edu

or

 $ mutt dbp etch a-liu

In either case, mutt will prompt you for an address and then a subject. It will then open a copy of your preferred text editor (from the shell environment variable EDITOR) for composing the mail. After entering the message, save your changes and exit the editor.

You will now see the mutt Compose message screen, which allows you to modify the header information. To edit the message again, type e. To check the spelling in your file, use i (for ispell, which is a spell checker). To attach a file to your mail, type a at this screen. If you press TAB, you will be able to browse through your file system to select the attachment.

When you’ve finished editing your message, press y to send it. To abandon the message without sending it, use q. You will be given the chance to save the draft for later. To resume a draft, just start to compose another message with m.

The mutt Address Book

You can create an address book of the e-mail addresses you most frequently need. To add an entry, just type a while you are at the message list. mutt will prompt you before adding the address on the current message to your address book. You can change the alias, address, and name on the entry before accepting it.

Once you have created an address book, you can use the aliases instead of typing full e-mail addresses when you compose mail. You can also use the TAB key to look up entries when mutt prompts you for an address.

Configuring mutt

Unlike pine, mutt does not have a built-in editor for its configuration settings. Instead, you can create a file called ~/.muttrc and edit the settings by hand, just as you would do with your shell configuration files. On the other hand, mutt lets you customize more than pine does; for example, you can change the default key bindings (so that you use different buttons for each action).

This sample .muttrc file shows some of the most common and useful settings:

 #  Sample ~/.muttrc file. #  Configuration Settings for mutt # Set your real name, to use when sending mail set realname = "Jonathan B" # Sort messages by threads, a very popular feature set sort = threads # Change a few of the color settings color status black white color indicator white blue         # On a non-color terminal: mono indicator bold # Use vi (or emacs) as the default editor set editor=vi                      # or set editor=emacs # Use an external pager, such as less set pager=less # Force mutt to always prompt for bcc: addresses when sending mail set askbcc # Force mutt to never ask for confirmation before deleting messages set noaskdelete                    # Or unset askdelete # Go to the next message after modifying (for example, deleting) the current one set resolve # Mutt normally cancels a message if you exit from the editor without # saving any changes-turning that off allows you to send blank messages set noabort_unmodified # By default, mutt saves address book entries in your .muttrc, along # with all these configuration settings, but this will save aliases # in ~/.muttalias instead. You have to explicitly read in the new file: set alias_file=~/.muttalias source ~/.muttalias # Address book entries look like # alias aliasname addresslist # So you can add new aliases like this: alias copyme mymainacct (My Main Account), myotheracct (My Other Account) # When receiving mail from an address that's in your address book, # display the alias instead of the full address set reverse-alias # Configure all mail files to go in the folder muttmail by default set folder=-/muttmail # Keep a record of all sent messages # The plus is a shortcut for the value of folder, above set record="+sent-msgs" # Change where your read messages are saved set mbox "+mbox"                   # Same as set mbox ~/muttmail/mbox

For more configuration settings, see http://www.mutt.org/doc/manual/.

Remote Mail with mutt

mutt does not have any built-in features for working with remote mail. If you want to download your messages from a remote server and open them in mutt, see the fetchmail command in the section “Tools for Managing E-Mail.” If you need to send mail through a remote server, you will have to ask your system administrator about the sendmail configuration.




UNIX. The Complete Reference
UNIX: The Complete Reference, Second Edition (Complete Reference Series)
ISBN: 0072263369
EAN: 2147483647
Year: 2006
Pages: 316

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net