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

Commands Reference, Volume 1

bellmail Command

Purpose

Sends messages to system users and displays messages from system users.

Syntax

To Display Messages

bellmail-e ] [ -fFile ] [  -p ] [  -q ] [  -r ]

To Send Messages

bellmail-t ] User ...

Description

The bellmail command with no flags writes to standard output, one message at a time, all stored mail addressed to your login name. Following each message, the bellmail command prompts you with a ? (question mark). Press the Enter key to display the next mail message, or enter one of the bellmail subcommands to control the disposition of the message.

Use the User parameter to attach a prefix to messages you send. The bellmail command prefaces each message with the sender's name, date and time of the message (its postmark), and adds the message to the user's mailbox. Specify the User parameter by pressing End Of File (the Ctrl-D key sequence) or entering a line containing only a . (period) after your message.

The action of the bellmail command can be modified by manipulating the /var/spool/mail/UserID mailbox file in two ways:

To specify a recipient on a remote system accessible through Unix-to-Unix Copy Program (UUCP), preface the User parameter with the system name and an ! (exclamation mark). The [  -t User. . .uucp command contains additional information about addressing remote systems.

Note: In order to use the remote mail function, UUCP must be completely configured.

If you are interested in writing your own third-party mail program, you may need to know the following locking mechanisms used by the bellmail command.

  1. The bellmail command creates a UserID.lock file in the /var/spool/mail directory that is opened by passing the O_NSHARE and O_DELAY flags to the open subroutine. If the UserID.lock file is being held, your bellmail process sleeps until the lock is free.
  2. The bellmail command locks /var/spool/mail/UserID with the lockf subroutine.

Flags

-e Does not display any messages. This flag causes the bellmail command to return an exit value of 0 if the user has mail, or an exit value of 1 if there is no mail.
-fFile Reads mail from the named File parameter instead of the default mail file, /var/spool/mail/UserID.
-p Displays mail without prompting for a disposition code. This flag does not delete, copy, or forward any messages.
-q Causes the bellmail command to exit when you press Interrupt (the Ctrl-C key sequence). Pressing Interrupt (Ctrl-C) alone stops only the message being displayed. (In this case, the next message sometimes is not displayed until you enter the p subcommand.)
-r Displays mail in first-in, first-out order.
-t Prefaces each message with the names of all recipients of the mail. (Without this flag, only the individual recipient's name displays as addressee.)

The User parameter is a name normally recognized by the login command. If the system does not recognize one or more of the specified User parameters or if the bellmail command is interrupted during input, the bellmail command tries to save the message in the dead.letter file in the current directory. If the bellmail command cannot save the message to the dead.letter file, it saves the message in the $HOME/dead.letter file. Once in this file, the message can be edited and sent again.

Note: The bellmail command uses the $MAIL environment variable to find the user's mailbox.

Subcommands

The following subcommands control message disposition:

+ Displays the next mail message (the same as pressing the Enter key).
- Displays the previous message.
!Command Runs the specified workstation command.
* Displays a subcommand summary.
d Deletes the current message and displays the next message.
m User Forwards the message to the specified User parameter.
p Displays the current message again.
q Writes any mail not yet deleted to the /var/spool/mail/UserID file and exits. Pressing End Of File (Ctrl-D) has the same effect.
s [File] Saves the message in the named File parameter instead of in the default mail file, $HOME/mbox.
w [File] Saves the message, without its postmark, in the specified File parameter instead of in the default mail file, $HOME/mbox.
x Writes all mail unchanged to /var/spool/mail/UserID and exits.

Examples

  1. To send mail to other users, enter:

    bellmail tom rachel
    Don't forget the meeting tomorrow at 9:30 a.m.

    Press Ctrl-D at the end of the message. In this example, the system mails the message to users tom and rachel.

  2. To send a file to another user, enter:

    bellmail lance <proposal

    In this example, the file proposal is sent to user lance.

  3. To display your mail, enter:

    bellmail

    After the most recent message is displayed, a ? (question mark) indicates the bellmail command is waiting for one of the bellmail subcommands. Enter help or an * (asterisk) to list the subcommands available.

  4. To save a message or a file to the default mail file, enter:

    bellmail

    This command displays each message mailed to you. Press the Enter key after the ? prompt until the desired file is displayed. When the appropriate file is displayed, enter:
    s
    In this example, the file is saved in the default mail file, $HOME/mbox.

  5. To save a message or a file to a specific file, enter:

    bellmail

    This command displays each message mailed to you. Press the Enter key after the ? prompt until the desired file is displayed. When the appropriate file is displayed, enter:
    mycopy
    In this example, the file is saved in a file named mycopy, instead of in the default mail file.

Files

$HOME/dead.letter Unmailable text.
$HOME/mbox Your personal mailbox.
/usr/mail/*.lock Lock for mail directory.
/var/spool/mail/UserID Default system mailbox for UserID.
/usr/bin/bellmail Bellmail program.

Related Information

The mail command, uucp command.

The lockfx, lockf, or flock subroutine, open, openx, or creat subroutine.

Mail Overview in AIX 5L Version 5.2 System User's Guide: Communications and Networks.

Organizing Mail in AIX 5L Version 5.2 System User's Guide: Communications and Networks.

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