2016-01-04 18:27:47 +08:00
|
|
|
# mailx
|
|
|
|
|
|
|
|
> Send and receive mail.
|
2021-10-05 17:50:45 +05:00
|
|
|
> More information: <https://manned.org/mailx>.
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
- Send mail (the content should be typed after the command, and ended with `<Ctrl d>`):
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`mailx {{[-s|--subject]}} "{{subject}}" {{to_addr}}`
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2017-04-15 13:17:23 +01:00
|
|
|
- Send mail with content passed from another command:
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`echo "{{content}}" | mailx {{[-s|--subject]}} "{{subject}}" {{to_addr}}`
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2017-04-15 13:17:23 +01:00
|
|
|
- Send mail with content read from a file:
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`mailx {{[-s|--subject]}} "{{subject}}" {{to_addr}} < {{content.txt}}`
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Send mail to a recipient and CC to another address:
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`mailx {{[-s|--subject]}} "{{subject}}" {{[-c|--cc]}} {{cc_addr}} {{to_addr}}`
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2017-04-15 13:17:23 +01:00
|
|
|
- Send mail specifying the sender address:
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`mailx {{[-s|--subject]}} "{{subject}}" {{[-r|--from-address]}} {{from_addr}} {{to_addr}}`
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Send mail with an attachment:
|
2016-01-04 18:27:47 +08:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`mailx {{[-a|--attach]}} {{path/to/file}} {{[-s|--subject]}} "{{subject}}" {{to_addr}}`
|