Using sendmail from bash script for multiple recipients

前端 未结 3 882
时光取名叫无心
时光取名叫无心 2021-01-31 08:33

I\'m running a bash script in cron to send mail to multiple recipients when a certain condition is met.

I\'ve coded the variables like this:

subject=\"S         


        
3条回答
  •  星月不相逢
    2021-01-31 08:51

    Use option -t for sendmail.

    in your case - echo -e $mail | /usr/sbin/sendmail -t and add yout Recepient list to message itself like To: someone@somewhere.com someother@nowhere.com right after the line From:.....

    -t option means - Read message for recipients. To:, Cc:, and Bcc: lines will be scanned for recipient addresses. The Bcc: line will be deleted before transmission.

提交回复
热议问题