Name
mail [options
] recipient
— MailX
Synopsis
/bin
stdin stdout - file -- opt --help --version
The mail
program (equivalently, Mail
)[17] is a quick, simple email client. Most people want a more powerful program for regular use, but for quick messages from the command line or in scripts, mail
is really handy.
To send a quick message:
$ mail smith@example.com Subject:my subject
I'm typing a message.
To end it, I type a period by itself on a line.
.
Cc:jones@example.com
$
To send a quick message using a single command:
$ echo "Hello world" | mail -s "subject" smith@example.com
To mail a file using a single command, use either of these:
$ mail -s "my subject" smith@example.com < filename $ cat filename | mail -s "my subject" smith@example.com
Notice how easily you can send the output of a pipeline as an email message.
Useful options | |
| Set the subject line of an outgoing message. |
| Verbose mode: print messages about mail delivery. |
| CC the message to the given addresses, a comma-separated list. |
| BCC the message to the given addresses, a comma-separated list. |
[17] On older Unix systems, Mail
and mail
were rather different programs, but on Linux they are the same: /usr/bin/Mail is a symbolic link to /bin/mail.
Get Linux Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.