Sending a mail from a linux shell script

后端 未结 11 2102
一个人的身影
一个人的身影 2020-12-04 06:52

I want to send an email from a Linux Shell script. What is the standard command to do this and do I need to set up any special server names?

11条回答
  •  天涯浪人
    2020-12-04 07:27

    If you want a clean and simple approach in bash, and you don't want to use cat, echo, etc., the simplest way would be:

    mail -s "subject here" email@address.com <<< "message"
    

    <<< is used to redirect standard input. It's been a part of bash for a long time.

提交回复
热议问题