mail
is a utility that can sends an email from command line.
In Ubuntu 12.04, the following command sends an email to to@domain.com
with empty body.
$ mail -s "mail test" -S replyto="replyto@domain.com" to@domain.com < /dev/null
- -s: specify subject on command line.
- -S: set variable. In this case, a variable
replyto
is set toreplyto@domain.com
. When a recipient of this email clicks ‘Reply to’ button on their client, the client will setTo
address toreplyto@domain.com
, instead ofFrom
address from the original mail.
(Note: options vary depending on the version of Ubuntu distribution.)
mail
reads its body from standard input. An email sent by this command has empty body because /dev/null
is used as body.