-->
Previous Table of Contents Next


Using Aliases and Mailing Lists

The mail program, like most e-mail programs, allows you to create an alias for an address and a group alias for a list of addresses. You can treat the group alias as a mailing list. Using an alias for an individual address is easier than using the regular address because the alias is typically shorter and easier to remember.

To set an individual or group alias for one mail session, you use the alias command at the ? prompt while you’re reading your e-mail. To make the aliases more useful, put the aliases in a file named .mailrc in your home directory (as described in the following section).

The following is an example of setting and using aliases with the mail program:

1.  Start mail by entering mail at the prompt. After the headers are presented, you see the ? prompt:

mail     Type ? for help.

“/var/spool/mail/bkorn”: 5 messages 2 new 1 unread

     1 sarah Wed Jan  5 09:17  15/363

     2 croster@kite.fish.com Thu Jan  6 10:18  26/657   Meeting on

       Friday

U    3 wjones Fri Jan  7 08:09  32/900   Framistan Order

> N  4 chendric Fri Jan  7 13:22  35/1347  Draft Report

N    5 kackerma@ps.com Sat Jan  8 13:21  76/3103  Excerpt from GREAT

       new Linux

?

2.  To set up an individual alias, use the alias command followed by the alias for the address. The following example creates the alias ros for the address croster@kite.fish.com:

   alias ros croster@kite.fish.com

3.  Use the ros alias in an address; mail expands it to its complete form. For example, you can enter the command m ros to start a message you want to mail to croster@kite.fish.com.

To set up a group alias, use the alias command followed by the alias for the addresses. The following creates an alias called friends and then forwards some mail to the group:


alias friends chendric karlack abc.com!homebase!fran eca@xy.srt.edu

m friends

Subject: Excerpts from new Linux book - get a copy!

~f 5

Interpolating: 5

~.

EOT

?

Customizing Your mail Environment

You can customize your mail environment by putting commands or set-environment variables in the .mailrc file in your home directory. The mail program checks that file whenever you use the program. You can set quite a few environment variables and commands in .mailrc, and different mail programs will use different commands. Check your man page for your mail program for a list of all the .mailrc options. Some of the commands mail recognizes are given earlier in the section “Getting Help with mail”; this section describes a subset of the commands and variables that can be used in the .mailrc file. Table 33.1 lists these commands; Table 33.2 lists the environment variables.

Table 33.1 mail Commands

Command Definition

# Denotes a comment. No action is taken.
alias Sets an individual or group alias. Used as alias alias-name address-list.
set Sets an environment variable. Used as set variable-name or set variable-name=string.


TIP:  You can issue any of the commands in Table 33.1 from the ? prompt anytime you use mail; they’ll be active only for that session.
Table 33.2 mail Environment Variables

Variable Definition

askcc Prompts for the cc: list after the message is entered. Default is noaskcc.
asksub Prompts for the Subject list before the message is entered. Enabled by default.
noheader Doesn’t print header information on available messages when you start mail. Disabled by default.
ignore Ignores interrupt characters when you enter messages. Useful if you have a “noisy” connection over some telephone or other communication lines. Default is noignore.
metoo When you have your name in a group alias, a message normally isn’t sent to you. Setting this variable allows you to receive messages sent to a group alias that contains your address. Default is nometoo.


TIP:  You can set a system-wide environment by putting the commands or set variables in the /etc/mail.rc file.

The following example sets up the .mailrc file so that you use the commands and environment variables listed in Tables 33.1 and 33.2. The pound sign (#) is used to document the work. You can create this file by using vi or any other editor that can produce a text or ASCII file.


# .mailrc file for D. Wayne Love

# make sure interrupts are NOT ignored

set noignore

# set variables so that prompts for Subject and Cc always appear

set asksub

set askcc

# individual aliases

alias billy wcuth

alias ben benjamin@flagstaff.abaced.com

alias me dwlove

# group aliases, mailing list

alias mercs miles@dendarii.net quinn taura

alias research jones brown smith

alias googol djames bkorn cam@googol.org bkorn

Place these statements in the .mailrc file. Now whenever you start mail, these command statements are processed.

Quitting the mail Program

As you read e-mail in a mailbox, you can read, skip, or delete messages. (You learn about deleting messages later in this chapter.) These actions don’t take place in the mailbox itself, but in a temporary copy of the mailbox. You can quit the e-mail program so that your mailbox is changed by your actions (the modified temporary copy replaces the original mailbox), or you can quit so that your mailbox is unchanged regardless of what you did during your e-mail session.


Previous Table of Contents Next