Sending a mail from a linux shell script

后端 未结 11 2052
一个人的身影
一个人的身影 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:29

    If the server is well configured, eg it has an up and running MTA, you can just use the mail command.

    For instance, to send the content of a file, you can do this:

    $ cat /path/to/file | mail -s "your subject" your@email.com
    

    man mail for more details.

提交回复
热议问题