How to set the From email address for mailx command?

前端 未结 8 758
鱼传尺愫
鱼传尺愫 2020-12-24 05:28

I am working on a KornShell (ksh) script running on a Solaris server that will send out an email when and error condition is met. I am sending the email via mailx

8条回答
  •  情歌与酒
    2020-12-24 06:16

    On macOS Sierra, creating ~/.mailrc with smtp setup did the trick:

    set smtp-use-starttls
    set smtp=smtp://smtp.gmail.com:587
    set smtp-auth=login
    set smtp-auth-user=youremail@gmail.com
    set smtp-auth-password=yourpass
    

    Then to send mail from CLI:

    echo "your message" | mail -s "your subject" to_email@gmail.com
    

提交回复
热议问题