[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

System User's Guide: Communications and Networks

Customizing the Mail Program

Commands and options in the .mailrc and /usr/share/lib/Mail.rc files can be customized to fit your personal mailing needs.

Characteristics of a mail session that you can customize include:

For more information on customizing the mail program, see the following:

Enabling and Disabling Mail Options

Options can be either binary or valued. Binary options are either set or unset, while valued options can be set to a specific value.

Note: The form unset option is equivalent to set nooption.

Use the pg command to view the /usr/share/lib/Mail.rc. The contents of the /usr/share/lib/Mail.rc file define the configuration of the mail program. Alter the system configuration for your mail program by creating a $HOME/.mailrc file. When you run the mail command, subcommands in the .mailrc file override similar subcommands in the /usr/share/lib/Mail.rc file. The .mailrc options can be customized and are valid each time you use the mail program.

To execute mail commands that are stored in a file, use the source subcommand.

Prerequisites

The mail program must be installed on your system.

To Enable Mail Options

The mailbox subcommands most commonly used to alter the characteristics of a mail session are:

set Enables mail options.
source Enables mail options that are stored in a file. When reading mail, you can issue this subcommand at the mailbox prompt:

source PathName 

where PathName is the path and file containing the mail commands. Commands in this file override the previous settings of any similar commands for the duration of the current session. You can also alter the characteristics of the current mail session by typing commands at the mailbox prompt.

You can set these options while in the mailbox or by making entries in the .mailrc file.

Viewing the Enabled Mail Options: When reading your mail, type the set subcommand without any arguments to list all of the enabled .mailrc options. In this list, you can also see if a folder directory is selected, and if a log file is set up to record outgoing messages.

At the mailbox prompt, type:


set

A message similar to the following is displayed:

ask
metoo
toplines 10

In this example, two binary options are enabled: ask and metoo. There is no askcc entry in the list. This indicates that the askcc option is not enabled. The toplines option has been assigned the value 10. The ask, metoo, askcc, and toplines options are described in .mailrc File Formatsection of the AIX 5L Version 5.2 Files Reference

To Disable Mail Options

The mailbox subcommands most commonly used to alter the characteristics of a mail session are:

unset Disables mail options.
unalias Deletes the specified alias names.
ignore Suppresses message header fields.

You can set these options while in the mailbox or by making entries in the .mailrc file.

Note: The form unset option is equivalent to set nooption.

Changing the Prompt for the Subject and Carbon Copy (Cc:) Fields

Prerequisites

The mail program must be installed on your system.

To Enable or Disable Subject Field Prompting

You can enable or disable the subject field in the way shown in the following examples:

set ask Subject field prompting is enabled by editing the .mailrc file ask option.
unset ask Subject field prompting is disabled by editing the .mailrc file ask option.

To Enable or Disable Carbon Copy (Cc:) Field Prompting

You can enable or disable the subject field in the way shown in the following examples:

set askcc Carbon copy (Cc:) field prompting is enabled by editing the .mailrc file askcc option.
unset askcc Carbon copy (Cc:) field prompting is disabled by editing the .mailrc file askcc option.

Creating an Alias or Distribution List

Prerequisites

  1. The mail program must be installed on your system.
  2. You must know the names and addresses of users you want to include in your alias or distribution list.

To Create an Alias or Distribution List

You can create an alias or distribution list in the ways shown in the following examples:

alias    kath kathleen@gtwn
In this example, the alias kath has been listed for user kathleen at address gtwn. After you have added this line to your $HOME/.mailrc file, to send a message to Kathleen, type the following at the command line prompt:

mail kath

You are now able to send mail to Kathleen using this alias.

alias     dept dee@merlin anne@anchor jerry@zeus bill carl
After you have added this line to your $HOME/.mailrc file, to send a message to your department, type the following at the command line prompt:

mail dept

The message you now create and send will go to dee on system merlin, anne on system anchor, jerry on system zeus, and to bill and carl on the local system.

To List the Aliases and Distribution Lists You Have Created

Type the following at the mailbox prompt:


alias

OR

a

A list of the aliases and distribution lists is displayed.

Changing the Number of Message Headers or Message Text Lines Displayed in the Mail Program

By changing the .mailrc file, you can customize the ability to scroll through mailbox lists or through actual messages.

Prerequisites

The mail program must be installed on your system.

To Change the Number of Displayed Lines of the Message List

Each message in your mailbox has a one-line heading in the message list. If you have more than 24 messages, the first headings from the message list scroll past the top of your screen. The set screen option controls how many lines of the list are displayed at a time.

To change the number of lines of the message list that are displayed at a time, in your $HOME/.mailrc file, type:

set screen=20

In this example, the system will display 20 message headers at a time. Use either the (h)eader or z subcommand to view additional groups of headers. You can also type this subcommand at the mailbox prompt.

To Change the Number of Displayed Lines in a Long Message

If you display a message with more than 24 lines, the first lines of the message scroll past the top of the screen. You can use the pg program from within mail to browse through long messages if you have included the set crt option in the .mailrc file. The set crt option controls how many lines a message must contain before the pg program is started.

For example, if you use the t subcommand to read a long message, only one screen (or page) is displayed. The page is followed by a colon prompt to let you know there are more pages. Press the Enter key to display the next page of the message. After the last page of the message is displayed, there is a prompt similar to the following:

EOF:

At the prompt, you can type any valid pg subcommand. You can display previous pages, search the message for character strings, or quit reading the message and return to the mailbox prompt.

The set crt option is entered in the .mailrc file as:

set crt=Lines

For example:

set crt=20

specifies that a message must be 20 lines before the pg program is started. The pg program is started when you read messages with more than 20 lines.

To Change the Number of Displayed Lines at the Top of a Message

The top subcommand enables you to scan through a message without reading the entire message. You control how many lines of a message are displayed by setting the toplines option as follows:

set toplines=Lines

In this subcommand, the Lines variable is the number of lines, starting from the top and including all header fields, that are displayed with the top subcommand.

For example, if user Amy has the following line in her .mailrc file:

set toplines=10

when Amy runs the mail command to read her new messages, she receives the following display:

Mail  Type ? for help.
"/usr/mail/amy": 2 messages 2 new>
N  1 george   Wed Jan  6  9:47  11/257 "Dept Meeting"
N  2 mark     Wed Jan  6 12:59  17/445 "Project Planner"

When Amy uses the top subcommand to browse through her messages, she views a partial message, as shown in the following dialog:

top 1
Message 1:
From george Wed Jan 6 9:47 CST 1988
Received: by zeus
        id AA00549; Wed, 6 Jan 88 9:47:46 CST
Date: Wed, 6 Jan 88 9:47:46 CST
From: george@zeus
Message-Id: <8709111757.AA00178>
To: amy@zeus
Subject: Dept Meeting
Please plan to attend the department meeting on Friday
at 1:30 in the planning conference room.  We will be

The message is partially displayed because toplines is set to 10. Only lines 1 (the Received: field) through 10 (the second line of the message body) are displayed. The first line, From george Wed Jan 6 9:47 CST 1988, is always present and does not count in the toplines option.

Controlling What Information Is Displayed

By changing the .mailrc file, you can control what header information is displayed in a message. Some header information might be already turned off. Examine your /usr/share/lib/Mail.rc file for ignored header fields.

Prerequisites

The mail program must be installed on your system.

To Prevent the Date, From, and To Headers from Being Displayed

  1. Every message has several header fields at the top. These header fields are displayed when you read a message. You can use the ignore subcommand to suppress the display of header fields when a message is read. The format for the ignore subcommand is:

    ignore [FieldList]

    The FieldList can consist of one or more field names that you want to ignore when you display a message. For example, if user Amy includes the following line in her .mailrc file:

    ignore date from to

    and the file /usr/share/lib/Mail.rc has the line:

    ignore received message-id

    the result of using the (t)ype subcommand is:

    t 1
    Message 1:
    From george Wed Jan 6 9:47 CST 1988
    Subject: Dept Meeting
    Please plan to attend the department meeting on Friday
    at 1:30 in the planning conference room.  We will be
    discussing the new procedures for using the project
    planning program developed by our department.

    The Received:, Date:, From:, Message-Id:, and To: fields do not appear in the display. To display these fields, use a (T)ype or (P)rint subcommand or the top subcommand.

    Note: In the example, the From line is displayed. This is not the same as the From: field that has been listed in the FieldList for the ignore subcommand.
  2. To get a list of the currently ignored header fields, at the mailbox prompt, type:
    ignore

    A list of all currently ignored headers is displayed. For example:

    mail-from
    message-id
    return-path
  3. To reset the header fields, use the retain subcommand. For example:

    retain date

    To see which header fields are currently retained, type the retain subcommand without a header field parameter.

To Prevent the Banner from Displaying

The mail banner is the line at the top of the list of messages that shows the name of the mail program when you issue the mail command. It is similar to the following line:

Mail [5.2 UCB]  [Workstation 3.1] Type ? for help.

To prevent the banner from displaying when you start the mail program, add the following line to your $HOME/.mailrc file:

set quiet

Another option that suppresses the mail banner is:

set noheader

With this option in the .mailrc file, the list of messages in your mailbox is not displayed. When you start the mail program, the only response is the mailbox prompt. You can get a list of messages by typing the (h)eader subcommand.

To Combine the delete and print Commands

After you read a message, you can delete the message with the d subcommand. You can display the next message with the p subcommand. Combine these subcommands by typing the following line in your .mailrc file:

set autoprint

With the set autoprint option in the .mailrc file, the d subcommand deletes the current message and displays the next.

Creating Default Folders to Store Messages

Prerequisites

The mail program must be installed on your system.

To Create a Letters Mailbox Directory to Store Messages in Folders

  1. To check if the set folder option has been enabled in the .mailrc file, at the mailbox prompt type:

    set

    If the set folder option has been enabled, the system responds with the following:

    folder /home/george/letters

    In this example, letters is the directory in which mail folders will be stored.

  2. If the set folder option has not been enabled, make a set folder entry in the .mailrc file:
    set folder=/home/george/letters

    In this example, /home/george is George's home directory and letters is the directory in which mail folders will be stored. The set folder option will allow you to use the plus sign (+) shorthand notation to save messages in your letters directory.

  3. If a letters directory does not exist, you must create a letters directory in your home directory. From your home directory, at your system command line type:

    mkdir letters

To Keep a Record of Messages You Send to Others

  1. Type the following statement in your .mailrc file:

    set record=letters/mailout
  2. >If a letters directory does not exist, you must create a letters directory in your home directory. From your home directory, at your system command line type:

    mkdir letters
  3. To read copies of the messages you have sent to others, type:

    mail -f +mailout

    In this example, the file mailout contains copies of the messages you have sent to others.

Changing Text Editors Used for Typing Messages

Prerequisites

The mail program must be installed on your system.

To Define an Editor to Be Used

set EDITOR=PathName This option in your .mailrc file defines the editor that you activate with the ~e key sequence. The value of PathName must be the full path name to the editor program you want to use.

To change to the e editor, while in the mail program, type:

~e

This sequence activates the e editor or other editor that you have defined in the .mailrc file. Edit your mail message using this editor.

set VISUAL=PathName This option in your .mailrc file defines the editor that you activate with the ~v key sequence. The value of PathName must be the full path name to the editor program that you want to use. The default is /usr/bin/vi.

To change to the vi editor while in the mail program, type:

~v

This sequence activates the vi editor or other editor that you have defined in the .mailrc file. Edit your mail message using this editor.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]