Wednesday, March 13, 2013

Send mail from command line

One useful tool in administering servers is sending emeial from command line or batch script. This can be accomplished with mail command.

mail -s "Subject" -c <CC address> <e-mail address>

insert mail text
press CONTORL+D to finish and send mail

In case of empty message body:

[user@server ~]$ mail -s "Subject" mail.name@mail.com
EOT
Null message body; hope that's ok

No comments:

Post a Comment