Skip to main content

Send and receive mail.

# To send mail (the content should be typed after the command, and ended with 'Ctrl+D'):
mailx -s "subject" to_addr

# To send mail with content passed from another command:
echo "content" | mailx -s "subject" to_addr

# To send mail with content read from a file:
mailx -s "subject" to_addr < content.txt

# To send mail to a recipient and CC to another address:
mailx -s "subject" -c cc_addr to_addr

# To send mail specifying the sender address:
mailx -s "subject" -r from_addr to_addr

# To send mail with an attachment:
mailx -a file -s "subject" to_addr