2019-09-16 18:03:43 +01:00
# mail
> The command operates on the user's mailbox if no argument is given.
2023-08-09 06:29:02 +01:00
> To send an email the message body is built from `stdin`.
2021-10-05 13:50:45 +01:00
> More information: <https://manned.org/mail>.
2019-09-16 18:03:43 +01:00
2021-05-20 21:13:41 +01:00
- 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:
2019-09-16 18:03:43 +01:00
2020-10-04 18:33:38 +01:00
`mail --subject="{{subject line}}" {{to_user@example.com}}`
2019-09-16 18:03:43 +01:00
- Send an email that contains file content:
2020-10-04 18:33:38 +01:00
`mail --subject="{{$HOSTNAME filename.txt}}" {{to_user@example.com}} < {{path/to/filename.txt}}`
2019-09-16 18:03:43 +01:00
2021-01-31 17:05:18 +00:00
- Send a `tar.gz` file as an attachment:
2019-09-16 18:03:43 +01:00
2020-11-01 13:40:05 +00:00
`tar cvzf - {{path/to/directory1 path/to/directory2}} | uuencode {{data.tar.gz}} | mail --subject="{{subject_line}}" {{to_user@example.com}}`