Sends messages to system users and displays messages from system users.
bellmail [ -e ] [ -fFile ] [ -p ] [ -q ] [ -r ]
bellmail [ -t ] User ...
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:
Forward to person
This instruction causes all messages sent to the User parameter to be sent to the Person parameter instead. The Forward to feature is useful for sending all of a person's mail to a particular machine in a network environment.
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.
-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.
The following subcommands control message disposition:
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.
bellmail lance <proposal
In this example, the file proposal is sent to user lance.
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.
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.
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 mycopy
In
this example, the file is saved in a file named mycopy, instead of in the default mail file.
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.