|Previous||Table of Contents||Next|
The external mailx command is an electronic post office. You can send, receive, and store messages using the mailx command. It is based on the old mail command but provides a much better interface for handling messages.
You can use the tilde (~) commands to edit, review, and modify your message before sending it to the recipient. You can list, display, save, delete, and pipe messages while in command mode. In general terms mailx provides you with a memo/message handler. You can send to one or multiple users. You can reply to the original author or to the author and all other recipients of a message. It even allows you to store messages and replies in files based on user names.
Like many of the UNIX commands mailx has been changed and enhanced by most vendors. Therefore, there is no guarantee the information that follows pertains exactly to your system's mail program. The mailx information that follows is AT&T System V. The mail information is from various BSD based systems. Information common to all systems was used, hopefully providing a complete base of information for the BSD mail command.
Throughout the module we refer to the mailx command. The BSD mail command is assumed to be synonymous unless stated differently.
The old mail command is not documented in this book. It is slow, limited, and cumbersome to use. The BSD mail is usually located in /usr/ucb/mail. The mail program in /bin/mail is the old version of mail.
Following is the general format of the mailx command.
To Read Mail:
mailx [ -deFHIinNUV ] [ -f file ] [ -u user ] [ -T file ]
To Send Mail:
mailx [ -dFinUV ] [ -h num ] [ -r adr ] [ -s subject ] recipients
|To Read Mail:|
|/usr/ucb/mail [ -inv ][ -f file ][ -u user ]|
|To Send Mail:|
|/usr/ucb/mail [ -inv ][ -s subject ]recipients ]|
If you specify user_names, mailx attempts to send the message to the list of users. If you do not specify any user_names, mailx reads messages from your mailbox or specified file and enters command mode.
The following list describes the options and their arguments that may be used to control how mailx functions.
|-d||Turn on debugging mode. Debug statements are displayed.|
|-e||Checks for any mail in your mailbox. Nothing is displayed. A return code of 0 (true) is returned if mail does exist. A return code of 1 (false) is returned if no mail exists.|
|-F||Saves the mail message in a file named after the first user who received the message. This option overrides the internal record variable.|
|-f file||Reads mail from the file named file instead of your mailbox file (/usr/mail/ mylogin, BSD is /usr/spool/mail/mylogin). If you do not specify file, the file named mbox is used.|
|-H||Displays only the header summary information and exits from mailx.|
|-h num||Sets the number of "hops" a message has made to num. A hop is when a message is sent from one system to the next via a LAN (Local Area Network) or telephone line. This number is used by network mail delivery software to avoid infinite delivery loops. It is not intended for human use. Refer to the addsopt variable in the Internal Variables section.|
|-i||Causes mailx to ignore INTERRUPT signals. Refer to the ignore variable in the Internal Variables section.|
|-I||Displays the newgroup and article-id header lines in addition to the standard header lines that are displayed. Requires the -f option to be specified.|
|-n||Causes mailx not to initialize from the system default file, /usr/lib/mailx/ mailx.rc.|
|-N||Causes mailx not to display the header information during initial startup. By default, mailx displays the header line for each message contained in the mailbox file being read.|
|-r adr||Passes the address adr to network delivery software. The tilde commands are disabled. This option is used by mail delivery software. It is not intended for human use. Refer to the addsopt variable in the Internal Variable section.|
|-s subject||Sets the subject field of the message to subject. If subject contains blanks, you must use quotes. If this option is not used, you are prompted for a subject message each time you send a message to a user.|
|-T file||The message-ID and article-id header lines are saved in file after the message is read. Automatically sets the -I option.|
|-u user||Causes mailx to read messages from user's mailbox instead of your own. The specified user's mailbox must be readable by your userid. If it is read protected, mailx will complain and fail.|
|-U||Converts a uucp type address to internet standard type address. This option overrides the internal variable conv. Refer to the Internal Variables section.|
|Previous||Table of Contents||Next|