UNIX Basic commands: mail
The mail command allows you to read or send mail. If users is left blank, it allows you to read mail. If users has a value, then it allows you send mail to those users.
Syntax
The syntax for the mail command is:
mail [options] [users]
Options for reading mail
Option | Description |
---|---|
-e | Check if mail exists. Exit status is 0 if mail exists and 1 if mail does not exist. |
-f file | Read mail from mailbox called file. |
-F names | Forward mail to names. |
-h | Displays messages in a window. |
-i | Ignore interrupts |
-p | Displays all messages. |
-P | Displays all messages with header lines. |
-q | Terminate when an interrupt occurs. |
-r | Displays oldest messages first. |
-U | Convert uucp-type addresses to Internet format. |
-v | Verbose. |
Options for sending mail
Option | Description |
---|---|
-m type | Display a "Message-type:" line at the heading of the message, followed by type. |
-t | Display a "To:" line at the heading of the message with the names of the recipients. |
-w | Send mail to users without waiting for a remote transfer program to finish. |
-F | Save message in a file called the name of the first recipient. |
-h n | If message has not been sent after n network connections, do not send message. |
-i | Ignore interrupts |
-r address | address is the return address for mail messages. |
-s subject | Displays subject in the subject header. |
-U | Convert uucp-type addresses to Internet format. |
-v | Verbose. |
* Please note that there are many flavors of UNIX, so if in doubt, consult your man pages.
Advertisements