The command operates on the user’s mailbox if no argument is given. To send an email the message body is built from
stdin
. More information: https://manned.org/mail.
mail
<Enter>
. Input message text (can be multiline). Press <Ctrl>-D
to complete the message text:mail --subject="subject line" [email protected] --cc="cc_email_address"
mail --subject="$HOSTNAME filename.txt" [email protected] < path/to/filename.txt
tar.gz
file as an attachment:tar cvzf - path/to/directory1 path/to/directory2 | uuencode data.tar.gz | mail --subject="subject_line" [email protected]