Mailx syntax
mailx
is a command-line email client that allows you to send and receive email messages. Here are some basic syntax and options:
Basic Syntax:
mailx [-options] [-to recipient] [-cc recipient] [-bcc recipient] [-subject subject] [-body body]
Options:
-h
or--help
: Display help message and exit.-v
or--version
: Display version information and exit.-s
or--send
: Send the message immediately (default is to save it to a file).-f
or--file
: Specify the file to read the message from (default is standard input).-a
or--attach
: Attach a file to the message.-t
or--text
: Send the message as plain text (default is to send as MIME).-b
or--batch
: Send the message in batch mode (no interactive prompts).
Recipient Options:
-to
or--to
: Specify the recipient(s) of the message.-cc
or--cc
: Specify the carbon copy recipient(s) of the message.-bcc
or--bcc
: Specify the blind carbon copy recipient(s) of the message.
Message Options:
-subject
or--subject
: Specify the subject of the message.-body
or--body
: Specify the body of the message.
Examples:
- Send a message to
[email protected]
with the subject "Hello" and body "Hello, how are you?":mailx -s -to [email protected] -subject "Hello" -body "Hello, how are you?"
- Send a message to
[email protected]
with the subject "Hello" and body "Hello, how are you?" and attach a fileexample.txt
:mailx -s -to [email protected] -subject "Hello" -body "Hello, how are you?" -a example.txt
- Send a message to
[email protected]
with the subject "Hello" and body "Hello, how are you?" in batch mode:mailx -b -to [email protected] -subject "Hello" -body "Hello, how are you?"
Note: The exact syntax and options may vary depending on the specific implementation of
mailx
you are using.