mail is a command line email client for Unix and Unix-like .
"Electronic mail was there from the start", M. Douglas McIlroy writes in his article "A Research UNIX Reader: Annotated Excerpts from the Programmer’s Manual, 1971-1986",
and so a mail
command was included in the first released version of research Unix, First Edition Unix.
This version of mail was capable to send (append) messages to the mailboxes of other users on the Unix system, and it helped managing (reading) the mailbox of the current user.
In 1978 Kurt Shoens wrote a completely new version of mail for BSD2, referred to as Berkeley Mail. Although initially installed at /usr/ucb/Mail, (with the earlier Unix mail still available at /bin/mail), on most modern Unix and Linux systems the commands Mail, mail and/or mailx all invoke a descendant of this Berkeley Mail, which much later was the base for the standardization of a mail program by the OpenGroup, the POSIX standardized variant mailx.
[ POSIX standard entry] [ "mail, Mail, mailx, nail—history notes", Heirloom Project]
mail -s "You've got mail" -c email@example.com firstname.lastname@example.org email@example.com
This sends a message with the subject "You've got mail" to two recipients, firstname.lastname@example.org and email@example.com, and CCs (copies) a third, firstname.lastname@example.org. The message will be typed after the command is entered and will be ended with Control-D.
Any Unix command sequence that generates text can be used to send a message in one line. For example:
echo "Some message" | mail -s "meeting today" email@example.com
This is especially useful for having a system report its status automatically through email.