Solaris Advanced User's Guide

Setting Up Mail Aliases in .mailrc

Note the following about setting up mail aliases in .mailrc:

.mailrc is located in your home directory. This file contains several settings that control the behavior of mailx and Mail Tool.

To add a mail alias to .mailrc, type:


$ vi ~/.mailrc    

Note –

You can use any text editor to edit the .mailrc file. The previous example shows the method for using the vi editor to edit the file. If you are not already familiar with vi, refer to Chapter 6, Using the vi Editor for instructions.


Each mail alias is contained on one line of the file. That is, the line can visually “wrap around” to another line, but it cannot contain carriage returns. Each mail alias should contain the following, separated by spaces:

The following example shows two mail aliases. The first alias (amigos) contains three people. The second alias (softball) contains eight. Notice in softball how the names are visually wrapped around on the screen. This is fine, as long as no carriage returns are used.


alias amigos hank@fretful george@lonesome sally@dakota
alias softball earl@woofer tex@twister elmer@farmhouse
jane@freeway hank@fretful jj@walker sally@dakota steve@hardway

To send mail to people on a .mailrc alias, address the mail to the mail alias name. Do not include your machine name. Suppose that you sent the following message:


$ mail amigos
Subject: Let's eat

Hey Compadres. How about
getting together for lunch on Friday?
Anyone interested?

The recipients would see the following (note the expanded To: line):


To: hank@fretful george@lonesome sally@dakota
Subject: Let's eat

Hey Compadres. How about getting together for lunch on Friday?
Anyone interested?