Sets defaults for the mail command.
The .mailrc file can be placed in your $HOME directory to personalize the Mail program. You can create the .mailrc file with any ASCII editor. Once the file is created, the Mail program reads the file when you send or read mail, and applies the options you have set. In the file, you can define aliases for other users' mail addresses. You can also change the way mail is displayed and stored on your system.
The Mail program uses a master file in the same format, /usr/share/lib/Mail.rc. Options you set in your $HOME/.mailrc file override comparable options in the Mail.rc file.
A line that begins with a # (pound sign) followed by a space is treated as a comment. The Mail program ignores the entire line and any entries or options it contains.
Use the following mail subcommands as entries in the .mailrc file:
mail Subcommand | Definition |
---|---|
alias NewAlias { Address... | PreviousAlias... } | |
Defines an alias or distribution list. The alias can be defined as an actual mail address, or as another alias defined in a previous entry in the .mailrc file. To define a group, enter multiple addresses or previous aliases separated by spaces. | |
ignore FieldList | Adds the header fields in the FieldList parameter to the list of fields to be ignored. Ignored fields are not displayed when you look at a message with the type or print subcommand. Use this subcommand to suppress machine-generated header fields. Use the Type or Print subcommand to print a message in its entirety, including ignored fields. |
set [OptionList | Option=Value...] | |
Sets an option. The argument following the set option can be either an OptionList giving the name of a binary option (an option that is either set or unset) or an Option=Value entry used to assign a value to an option. | |
unset OptionList | Disables the values of the options specified in OptionList. This action is the inverse of the set OptionList entry. |
Use the set entry to enable options and the unset entry to disable options. Add the options you want to set or unset to the $HOME/.mailrc file. The options and the actions they generate are as follows:
append | Adds messages saved in your mailbox to the end rather than to the beginning of the $HOME/mbox file. |
ask | Prompts for the subject of each message sent. If you do not wish to create a subject field, press the Enter key at the prompt. |
askcc | Prompts for the addresses of people who should receive copies of the message. If you do not wish to send copies, press the Enter key at the prompt. |
autoprint | Sets the delete subcommand to delete the current message and display the next message. |
debug | Displays debugging information. Messages are not sent while in debug mode. This is the same as specifying the -d flag on the command line. |
dot | Interprets a period entered on a line by itself as the end of a message you are sending. |
hold | Holds messages that you have read but have not deleted or saved in the system mailbox instead of in your personal mailbox. This option has no effect on deleted messages. |
ignore | Ignores interrupt messages from your terminal and echoes them as @ (at sign) characters. |
ignoreeof | Sets the mail command to refuse the Ctrl-D key sequence as the end of a message. |
keepsave | Prevents the Mail program from deleting messages that you have saved with the s or w mailbox subcommand. Normally, messages are deleted automatically when you exit the mail command. Use the keepsave and hold options to hold messages in your system mailbox. Otherwise, the messages are placed in your personal mailbox ($HOME/mbox). |
metoo | Includes the sender in the alias expansion. By default, expanding the alias removes the sender. When this option is set in your .mailrc file, sending a message using an alias that includes your name sends a copy of the message to your mailbox. |
noheader | Suppresses the list of messages in your mailbox when you start the Mail program. Instead, only the mailbox prompt (&) is displayed. To get a list of messages, use the h mailbox subcommand. |
nosave | Prevents retention of interrupted letters in the $HOME/dead.letter file. |
quiet | Suppresses the printing of the banner when the Mail program starts. The banner is the line that shows the name of the Mail program. |
Replyall | Reverses the meaning of the reply subcommand and the Reply subcommand. |
verbose | Displays the actual delivery of messages on the terminal. This is the same as specifying the -v flag on the command line. |
You can use a set entry to assign values to the following options. For example, enter set screen=20 to limit headers to 20 lines per screen.
crt=Lines | Defines the number of lines of a mail message the Mail program displays before pausing for input (this option starts the pg command to control the scrolling). |
EDITOR=Editor | Gives the full path name of the editor to be started with the e mailbox subcommand or the ~e mail editor subcommand. The default editor is /usr/bin/e. |
escape=Character | Changes the escape character used for mail editor subcommands. The default character is ~ (tilde). |
folder=PathName | Gives the path name of a directory in which to store mail folders. Once the directory is defined, you can use the + (plus sign) notation to refer to it when using the FileName parameter with mailbox subcommands. |
record=FileName | Defines a file in which to record outgoing mail. The path name must
be absolute (that is, a full path name), or be given relative to the current
directory.
Note
If you set up a file to record outgoing messages,
read the file periodically with the mail -f command
and delete unnecessary messages. Otherwise, the file will grow and eventually
use all of your storage space. |
screen=Lines | Defines the number of lines of message headers displayed (for example, in response to the h mailbox subcommand) before pausing for input. |
toplines=Lines | Defines the number of lines displayed by the top mailbox subcommand. |
VISUAL=Editor | Gives the full path name of the editor to be started with the v mailbox subcommand or the ~v mail editor subcommand. The default editor is /usr/bin/vi. |
ignore message-id received
When messages are displayed in the mailbox, the machine message ID number and the date your system received the message are not displayed.
set folder=/home/kaye/notes
To save message 1 from the mailbox in the folder procedures, enter the following at the mailbox prompt (&):
s 1 +procedure
Message 1 is saved in the /home/kaye/notes/procedures file (if the file already exists, the message is appended to the file).
set record=/home/pierre/letters/mailout set folder=/home/pierre/letters
Outgoing mail is placed in the /home/pierre/letters/mailout file, and can be read with the following command:
mail -f +mailout
set autoprint metoo
The autoprint option causes the next message to be displayed whenever you delete a message. The metoo option causes the Mail program to send a copy of messages to you when it expands mail aliases. By default, the Mail program discards your user address when it expands an alias, so that you do not get a copy of mail you send.
unset askcc
This entry prevents the mail editor from requesting a carbon copy list when you create messages, even if the askcc option is set in the Mail.rc file.
alias george george@thor.valhalla.dbm.comm alias bill @odin.UUCP:@depta.UCCP:@deptb:bill@deptc alias mygroup amy@cleo george bill
To send mail to user bill using his alias, enter:
mail bill
To send mail to everyone in the mygroup list, enter:
mail mygroup
When you complete and send the message, the mail command actually addresses it as follows:
amy@cleo george@thor.valhalla.dbm.comm @odin.UUCP:@depta.UCCP: @deptb:bill@deptc
/usr/share/lib/Mail.rc | Contains systemwide defaults for the Mail program. |
$HOME/.mailrc | Contains user-specific defaults for the Mail program. |
Mail Editor Subcommands for the mail, Mail Command.
Mailbox Subcommands for the mail, Mail Command.
Creating and Sending Mail, Customizing the Mail Program, Mail Overview, Receiving and Handling Mail in AIX 5L Version 5.2 System User's Guide: Communications and Networks.