Read and send mail
The mail program is a very basic command-line email utility that can be used to read mail or send mail to users. This program only supports reading the local email queue, not emails stored on remote servers.
To send emails using the mail command, you must provide options such as the subject, recipient’s address, carbon copy address, etc. To specify a subject, use the -s option. To set a carbon copy address, use the -c option. The recipient’s email address terminates the mail command’s line. After you type the mail command, the program waits for input. After you are done writting the message, you can signal the end of the message by pressing Ctrl+D.
Here is an example:
In the picture above you can see that we’ve sent an email with the subject Hello to the user bob. A carbon copy has been sent to the user jack.
Using the mail command with no arguments displays all messages in your mailbox, as shown in the picture below:
After you view a message in your mailbox, the message is written to the file in your home directory (e.g. /home/bob/mbox). You can these messages by using the mail -f command: