[Home] [Up]

E-Mail with the elm mailer

Shamelessly stolen from the
University of Hawaii at Manoa
College of Engineering

(Jump to the index)

About electronic mail

Electronic mail, or e-mail is the term given to messages sent to and from users on the same machine or on other machines. The mail system consists of a mail daemon (pronounced like the word "demon") and a mailer program. On Wiliki, there are four mailer programs available for the users: elm, mail, mailx, and pine. Of these four, elm is the most popularly used mailer program on Wiliki, and is the topic of this tutorial. (Sorry, no statistics here, just my judgment and observation.)

The Mail daemon

The mail daemon is a program that runs in the background and services requests to send and accept e-mail. Every machine on a network has its mail daemon running to accept any e-mail incoming from another machine, as well as to service any e-mail sent locally within the same machine.

When a mail message for you is received by the mail daemon, regardless of whether it is a locally sent message or a message received from another machine, the incoming mail is saved to your mail in-box file. On Wiliki, this file is /usr/mail/username, where username is your own login ID. On other machines, such as Uhunix, the file name may be different, for example /usr/spool/mail/username. Your mail remains in this file until elm or some other mailer program deletes the mail from your mail in-box file.

Users sending mail to one another will not have to worry about what kind of mailer the recipient uses. In other words, mail sent using elm can be read by users using pine, and so forth. There are some features in elm discussed later that require the recipient to be using elm.

About the elm Mailer Program

Elm is a screen-oriented and easy-to-use program for sending and receiving e-mail. In addition to sending and receiving mail, elm also has additional features, such as mail forwarding, bouncing, saving, replying to received messages, and the creation of mailing lists, called aliases. Saved mail messages can be placed into mail folders for later retrieval.

Starting up with elm

You normally start elm up by typing elm at the prompt. When you start elm for the first time, it will ask you if you want to create two directories in your home directory. These directories, called .elm and Mail are used for the following purposes: The .elm directory is used to hold any customization and other setup files, and the Mail directory is used to store mail messages.

Once elm starts up, it divides the screen into three parts. At the very top of the screen there is one line showing you the current folder, (when you start up normally it is usually your e-mail in-box) the number of messages in this folder, and the elm version number. The middle of the screen contains a list of all mail messages in this particular folder, numbered starting from 1. There are six columns in this section of the files.

This figure shows a sample elm screen

The first column has the status of the mail message. The status is shown by one or more letters in it. 'N' signifies an new, unread message, 'O' signifies an old, unread message, and 'U' signifies an urgent message. If the first column is blank that message has already been read. An 'M' in this column signifies that the mail message is a "metamail" message, which means that it includes multimedia (i.e., graphics or sounds or other binary files), or has information in several sections. (See the section on including files.)

The second column contains the message number in the current folder. Messages can be selected by typing the message number and hitting return. If the screen is not big enough to display all messages, moving the arrow or typing the number will move the list of mail messages to the appropriate place.

The third column and fourth contains the date the mail was sent and the author of the mail message. The fifth column displays the number of lines the message has. Finally, the sixth column shows the subject of the mail message.

At the bottom of the screen, there is a menu with the commands available. The list of commands shown depends on the skill of the user. When you first use elm, you are at the "Beginner" level. The menu for "Beginner" looks like the following:

You can use any of the following commands by pressing the first character; d)elete or u)ndelete mail, m)ail a message, r)eply or f)orward mail, q)uit To read a message, press . j = move down, k = move up, ? = help

The menu does not show all the commands, but all the commands are still available. For a list of all commands, look at the end of this tutorial. Some of the more commonly used commands are described here:

Tags the highlighted mail message as deleted. The deletion doesn't take effect until you change folders or quit out of elm.
Forwards the highlighted mail message. Elm will first ask if you would like to edit the document before sending, and then ask for the forwarding address.
Sends a mail message. Elm will first ask for the recipient(s) of the message and then the subject, and who to send copies to. After receiving this information, elm enters the text editor. (The VI editor is used if it hasn't been customized.)
Quit elm. Elm will ask for confirmation of removing messages marked as deleted and saving the already-read email messages to the received folder.
Reply to the highlighted mail message. The addressee will be taken from the email message, so that sender of that message will receive a reply.
Undeletes the highlighted mail message.

Sending Mail Using elm

As mentioned in the above section, you can start composing a new mail message by using the 'm' command. Replying to a received mail message can be done with the 'r' command. For the 'm' command, you specify a recipient to your mail message. For the 'r' command, the recipient is automatically specified from the mail message being replied to. If the recipient has an alias or is a local user elm will show the recipient's "real name" in the To: field.

Next, elm asks for a subject. For the 'r' command, the subject field is automatically filled in, but you have to type return to enter it. Normally, for example, if a mail message was received with the subject "Invoice payment due", the subject for the reply would automatically be set to "Re: Invoice payment due". You can change the subject before hitting return in this reply mode.

The next step asks for a Cc: field. This is useful when you would like to send copies of this mail messages to other people. If not, just hit enter, and leave it blank. Finally, after these three fields are properly input, elm goes into the text editor. If you have not set any editor settings, elm will start the VI editor. (See section on changing default editor below for more information on this topic.)

After editing your mail message, elm gives you a set of options. You can choose to do one of the following: 'e' for edit, 'h' to edit the headers, 'c' to copy the message to a file, 's' to send it and 'f' to forget it. If you just press return, it will send the message to the recipient.

Including Files into Your Outgoing Mail

One feature which is not used often in elm is the include file feature. To use this feature, you have to put the following text within the body of your message:

[include file contenttype/subtype encoding]

The [include] has 3 arguments used to process your included files, as follows:

This is a file which must exist. You can specify the filename relative to your current directory, or via an absolute path.
This section tells the recipient's mail program what type of data is being included. See the sample data types listed below.
This is an optional parameter, of which base64 and 7bit are two sample valid encoding methods.

When you place this text into your message, elm will automatically look for the file and include it in your mail message. The recipient of this mail must have the capability to read MIME (Multipurpose Internet Mail Extension) mail messages. Here are some commonly used MIME types:

If you have received MIME mail, you may experience difficulty viewing included files, such as images on your terminal. In order to save your mail message instead of having the metamail program attempt to display each section of the e-mail, pipe your mail message (using the | command) to the command, metamail -w. This will allow you to create temporary files which you can download to your computer for local browsing. Note that the files created may or may not be binary files so be careful when downloading these files to your computer.

Encrypting Your Outgoing Mail

The version of elm which is compiled for use on Wiliki has the feature to allow you to encrypt portions of the outgoing message. In order to do this, include the following text before the text you wish to have encrypted:


When you are done with encryption, follow the text with the following text:


When you are finished composing your mail message, you would send your mail in the same way as a normal mail message. However, after specifying to send your mail, elm will ask for an encryption key. Similar to the passwd command, you will be prompted for this password twice.

Note that when you send encrypted mail, your recipient must also be using a version of elm with the encryption configured. Other mailers will not be able to read encrypted mail created by elm. Be sure your recipient(s) do know the encryption key.

Adding Customized Headers To Your Outgoing Mail

Elm has the capability to allow you to include some customized headers. The custom header capability allows you to include new headers or replace already-existing headers. In order to use this capability, use any text editor to create a file called elmheaders in your .elm directory. Follow this format when creating a header entry:

Headertype: value

The kind of header you would like included is to the left the colon, while its value is included to the right of the colon. If you use the "backquote-notation", you can also include the output of various commands. For example, the following header line includes the users currently logged on to Wiliki:

Users: `users`

Elm runs the program users and puts its output in the header.

Different Ways to Start elm

In addition to starting up elm by simply typing elm, there are other ways to start up elm, by specifying optional arguments. Here is the form of the elm command with optional arguments.

elm [-hmvz] [-f foldername] elm [-s subject] list of addresses

The first form is used for reading. Any of those options shown can be given individually or all together. The flags have these meanings for the first form:

Starts elm by reading a specified folder instead of the in box. (See below for information about folders.)
Prints a help screen, with a list of all the optional arguments.
Turns off the menu at the bottom of the screen.
Gives you the version of elm currently available.
It enters elm only if there is mail to read.

The second form is used for sending only. A subject can be specified with the -s option, and the subject is followed by a list of addresses to send the mail message to. For example, the following lines shows how to use elm in the send-only mode.

elm ben
This command will start elm up in send-only mode, with the recipient being set to "ben". After entering the command, elm will ask for the subject, and who to send copies to. After that information is given, elm will go to the editor.
elm -s"Test subject" ben
This form of the command will let you start elm up in send-only mode, with the subject specified on the line. When elm starts up, the cursor will be on the Subject: field. Hitting return will accept the specified subject, and it'll ask who to send copies to. After the information is given, elm enters the editor.
elm ben dude < outputfile
This command will send the contents of the outputfile named outputfile to the two users specified at the command line.
elm -s"Fix my program" prof my_ta < outputfile
This command will send the contents of the outputfile named outputfile to the two users specified at the command line, with the subject, "Fix my program".

Folders in elm

Elm has a capability to save old mail into files called folders. These folders reside in your Mail directory, and are copies of the mail messages previously read (or sent). In order to create a folder, you merely have to save a message into it. If the folder doesn't exist, elm creates one for you. The command to save the currently highlighted mail message is 's', which will prompt you for a folder to save the email in. By default, Elm will put an equal sign followed by the sender's login id.

The equal sign has a special meaning to elm. It is replaced by your Mail directory in your home directory. For example, =ben becomes ~/Mail/ben, where ~ stands for your home directory. This convention also works when starting elm with the -f option. Typing elm -f +junk will start elm by reading a folder in your Mail directory called junk.

The same manipulations can be done to other folders as you can to your in box. Mail saved into folders can be deleted, saved to a different folder, replied to, bounced or forwarded. Within elm, you can use the 'c' command to change the current folder to be a different folder. When you type the 'c' command, elm will ask for the folder name. In order to get a list of all folders in the Mail directory, you can type in the folder named =*.

Creating/Maintaining Aliases

Elm has a facility to create abbreviations or short names of some of the addresses or groups of addresses you send mail to frequently. These short names are called aliases. Elm maintains a list of these aliases, and the alias menu can be accessed by the 'a' command. The alias menu looks similar to the mail index, but instead of mail messages, defined aliases are listed in this screen. The alias menu has its own set of commands, some of which are listed here.

Deletes the currently highlighted alias definition.
Edit the alias text file using the editor.
Show the address(es) of the alias.
Create a new alias.
Return to the mail index.

In order to create a new alias, you use the 'n' the command. After entering the command, elm will ask for the alias name. This is the name used in the To: field when sending mail. After entering the alias' name, you will be asked to enter the last and first names of the alias, as well as an optional comment. If you do not want to type the names in, just hit return. Next, you will be asked to supply the address(es) of the person/people in the alias. If you want to specify many names, separate the names with a comma, making sure there are no spaces within the list of addresses. Finally, elm will ask you for confirmation in accepting this alias.

After creating the alias, use the 'r' command to return to the mail index. Elm will re-create your alias file, and once in the mail index, the aliases will be ready to use. Below is an example alias being created:

Enter alias name: monitors Enter last name for monitors: H244 Lab Monitors Enter first name for monitors: Enter optional comment for monitors: Enter address for monitors: jhiguch,lien,shimko,luzhang Accept new alias? (y/n) y

The next time you want to send email to your friendly lab monitors, you can send email to "monitors", and elm will expand the addresses and send mail to the four users specified in the example.

Manually editing the alias file

The aliases.text file is the text version of the alias file. Before elm can use this file, it must be formatted. If you want to change the aliases.text file to make a few short changes, it is easier to change the file directly, rather than use the 'c' command in the alias menu. This is because the 'c' command requires you to type in all addresses of an alias, if you want to add or subtract names from an alias definition. The aliases.text file contains lines with this format:

aliasname = last name; first name, optional comment = address(es)

You can enter the editor to manually change this file using the 'e' command from the alias menu. For example, for the alias above, the corresponding line in the aliases.text file looks as follows:

monitors = H244 Lab Monitors = luzhang,jhiguch,spae,yogi,rwong

You can make changes to the contents of this file using the editor and after saving the file, elm will automatically reformat the file so that it can use the aliases afterwards. If there are any errors in the formatting of the file, elm will complain about it, and will not accept the alias. Remember that there are no spaces allowed in the last part of the alias.

Customizing your elm Setup with the Options Editor

Elm has a simple customization screen, but it doesn't have all the options for customizing. Certain options need to be customized manually, and are described later in this section. The command to get into the options menu is 'o', from the mail index. The Options Editor screen has 13 options, and some of the options are on or off, while others are text input. For certain fields, you can switch between settings using the space bar.

Changing your user level

For example, to change the user level, first type the 'u' command to start changing the user level. Then you can hit the space bar to switch between Beginner, Intermediate, and Expert. The basic difference is the menu changes for the different user levels.

Changing your default editor

Another useful option to set is the editor option. Start changing the editor for elm by getting into the options menu with 'o' and then typing 'e' to change the editor. After you type the 'e' to change the editor, you type over the text existing in the field. For example, if you want to use the pico editor (which is a very simple editor, written with the beginning user in mind) instead of the vi editor, you would type /usr/local/bin/pico -t into the editor field. If you want to change the editor back to the vi editor, type /usr/bin/vi in the editor field.

After modifying any options, type the '>' to save the settings. These settings are saved in the file, ~/.elm/elmrc and this file can be manually modified to customizing settings. The settings file is not created until you save the file using the '>' command in the options menu.

Manual Customization of the elmrc file

As mentioned above, there are many options available in the elmrc file. Using any text editor, edit this file to change any desired settings. The lines in this file have the following format:

option = VALUE

Where option is a customization option, and VALUE is the value of that option. Many options can only be either "ON" or "OFF". Some options can contain words. If any line begins with a pound sign (#), the line is considered a comment, and is ignored. The default elmrc file that is created using the '>' command in the options menu creates an elmrc file that contains comments to explain these options.

For example, the "copy" option can be either ON or OFF. If it is ON, elm saves a copy of all outbound mail into either the =sent folder or the folder of the addressee. A list of the options are given in the last section of this tutorial.

Command List

Top level commands: (note: ^X stands for control-X)

space, return
read current message
a number
go to specified message
delete message with pattern
redraw screen
tag messages with pattern
undelete messages with pattern
execute shell command
@, #
debugging commands
resynchronize folder
show full address of mail
toggle delete/undelete
show next index page
show previous index page
go to the first message
go to the last message
search subjects for pattern
search entire messages
save this or tagged message(s)
search for calendar entries
pipe message to command
alias menu
bounce mail
change folder
delete message
forward mail
group reply
view with headers
move the cursor down
move the cursor up
limit message display
mail message
next message
options menu
print mail
quit elm
reply to mail
save mail
tag message for later operation
undelete message
exit elm without saving changes
copy mail
move cursor down
move cursor up
quick quit
quick exit

Alias menu commands:

resynchronize aliases
toggle delete alias
make an alias for current message
change alias
delete alias
manually edit aliases.text
fully expand alias
return to main screen
move cursor down
move cursor up
limit alias display
send mail to alias
add new alias
return to main screen
return to main screen
view alias email addressed
exit alias menu

Options menu commands:

save options
select arrow/highlight cursor
set calendar file
pager to display mail with
editor to use to compose messages
mail folder directory
display the three-line menu
display names only/addresses
folder to save outbound mail to
program to print the mail with
visual editor
full name used when sending mail

Setup files/directories:

alias list
personal headers
main setup file
directory to hold old mail

Option List

Note: Those options in boldface can be either ON or OFF.

Sets default answer to "Delete messages?"
Sets default answer to "Keep unread mail in the incoming mailbox?"
Sets default answer to "Store read mail in 'received' folder?"
Sets the arrow cursor to be used to mark the current message. If set to OFF, the highlight cursor is used whenever possible.
If set, elm asks to delete messages, keep unread mail, and store read mail when exiting.
If set, elm asks to send copies of message to others. Using the Cc: field.
If set, the mail being replied to is copied into the edit buffer.
If set, elm asks for confirmation when appending to a folder.
If set, elm asks for confirmation when creating a new folder.
If set, elm saves the outgoing mail to folders. If a folder does not exist for a certain mail recipient, a copy of the outgoing mail is saved into the sent folder.
Full name of yourself, as sent by elm.
The directory where the mail folders are kept.
If set, a 3-line menu is printed on the bottom.
Sequence used for indenting messages being replied to. (In order to include spaces, use the underscore "_".)
set a file used to append a signature at the end of messages.
A number describing how good the user is at using elm. 0 is beginner, 1 is intermediate, and 2 is expert.


Please email your comments or questions to the following address:
ben@wiliki.eng.hawaii.edu (Ben Y. Yoshino)
Last updated on Thursday, May 4, 1995
Copyright © 1995 University of Hawai`i, College of Engineering, Computer Facility
All rights reserved.