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.
-
Send a typed email message. The command-line below continues after pressing Enter key. Input CC email-id (optional) press Enter key. Input message text (can be multiline). Press Ctrl-D key to complete the message text:
mail --subject="{{subject line}}" {{[email protected]}}
-
Send an email that contains file content:
mail --subject="{{$HOSTNAME filename.txt}}" {{[email protected]}} < {{path/to/filename.txt}}
-
Send a
tar.gz
file as an attachment:
tar cvzf - {{path/to/directory1 path/to/directory2}} | uuencode {{data.tar.gz}} | mail --subject="{{subject_line}}" {{[email protected]}}
License and Disclaimer
The content on this page is copyright © 2014—present the tldr-pages team and contributors.This page is used with permission under Creative Commons Attribution 4.0 International License.
While we do attempt to make sure content is accurate, there isn't a warranty of any kind.