Solaris Advanced User's Guide

Sending Messages

To send mail with the mailx program, you need to know the login name(s) of the intended recipient(s) of your message. If an intended recipient is on a different machine, you also need to know that user's machine name. To determine this information, you can use the who, finger, or rusers commands.

Type the who command to list all the users who are currently logged in to the file server you are on. The displayed list contains users' login names, their terminal types, and the date and time they logged in. For example:

$ who
    elmer      tty15        Feb 20 10:22
    susan      tty04        Feb 20 10:37
    stormy     tty07        Feb 20 11:49
    hankw      tty06        Feb 20 12:02

Type the finger command to display the same type of information as who with more detail. The information that appears depends on how your system administrator has set up this command. As an example, you might see something like the following:

$ finger
    Login     Name           TTY      Idle     When
    elmer     Elmer Brown    tty15     43      Thu 10:22
    susan     Susan Lake     tty04             Thu 10:37
    stormy    Stormy Ball    tty07     12      Thu 11:49
    hankw     Hank Wilson    tty06     22      Thu 12:02

The rusers command provides information on the users who are currently logged in to your local network. Refer to Chapter 9, Using the Network for instructions on the use of the rusers command.

When you have determined the necessary user information, complete the following steps to send a message.

  1. Type the mailx command, followed by a user's address:

    $ mailx user@machine

    In this command, user is the intended recipient's login name and machine is the name of the intended recipient's machine.

    • If you've already started mailx, you can just type m at the mailx prompt, followed by the intended recipient's login and machine name:

      & m user@machine
    • To send the same message to multiple recipients, separate each address with a space or a comma, for example:

      $ mailx hank@fretful sally@dakota tex@twister


      $ mailx hank@fretful,sally@dakota,tex@twister
  2. When you press Return, the mailx program prompts you for a subject. Type a subject for your message and press Return again.

  3. Type the body of your message. To create a new line, press Return.

    A sentence that wraps on your screen is not considered a new line until you press Return.

    Note –

    Each line of text within your message can be up to 256 characters long. When you exceed this limitation, your screen freezes. If this situation occurs, press Ctrl-C to abort your message.

  4. When you have completed your message, press Return to move the cursor to a new line. Then press Ctrl-D to send your message.

Undeliverable Messages

If you specify an incorrect user address when you send a message, the system responds with the message

user@machine...User unknown

The message is then returned to your mailbox. The next time you type the mailx command, the header states that you have returned mail, similar to the following example:

N 1 Mailer-Daemon Fri Jan 3 11:13 8/49 Returned mail: User unknown

When a message cannot be delivered, the file is also copied to a file in your home directory named dead.letter.

Canceling an Unsent Message

You can cancel a message at any time before it is sent by pressing Ctrl-C twice.

Adding Carbon and Blind Carbon Copies

Before sending a message, you can specify that “carbon copies” be sent to other than the main addressees. You can also send “blind carbons.” This specification ensures that recipients of your message can read the addresses for the carbon copies, but not the addresses for the blind carbons.

Many people send themselves carbons or blind carbons in order to retain a copy for their own record.

You can use three methods for sending carbon copies with a message:

~c hank@fretful george@lonesome stormy@snoozer

Inserting a Copy of a Message or File

You can insert a copy of any message in your mailbox into the message you're writing. Likewise, you can insert a copy of any text file.

Inserting a Message

Use the following command form to insert a message.

~m number

In this example, number is the number of the message to be inserted. For example, to send to another user a message that includes a copy of message number 3 from your mailbox list, complete the following steps.

  1. On a new line, type the command ~m 3, and then press Return.

    mailx displays the following message.

    Interpolating: 3 (continue)

  2. You do not see the text of message 3, but the recipient will. You can continue to compose your message after (continue), or you can send it as is.

  3. To see the complete message, interpolation included, type the command ~p.

Inserting a File

You can also insert a copy of any text file into a message. As you are writing a message, use the following command form.

~r filename

For example, to insert the file outline in the current message, type the following command.

& ~r outline

Replying to a Message

Reply to mail at a mailx prompt by typing the following command.

r number

If you omit the message number, mailx replies to the current message.

For example, to reply to the sender of message 2, type the following command.

& r 2

mailx automatically addresses your message and supplies an Re: Subject: line that echoes the original Subject: line. Send your reply as you would with any other message.

R is a variant of the reply command that sends your reply to all recipients of the original message as well as to its sender. Use this command only when absolutely necessary, to avoid generating “junk mail.”

Note –

You can insert a message into your reply as shown in the previous section. To insert a copy of the message to which you are replying, type the command ~m without a message number.