我正在cron中运行一个bash脚本,以便在满足特定条件时向多个收件人发送邮件。
我已经编写了这样的变量:
subject="Subject" from="[email protected]" recipients="[email protected] [email protected]" mail="subject:$subject\nfrom:$from\nExample Message"
而实际发送:
echo -e $mail | /usr/sbin/sendmail "$recipients"
问题是只有[email protected]收到邮件。如何更改这个,所有收件人都收到电子邮件?
注意:解决方案必须是使用sendmail,我正在使用jailhell,它似乎是唯一可用的方法
尝试这样做:
recipients="[email protected],[email protected],[email protected]"
另一种方法,使用shell这里 – doc:
/usr/sbin/sendmail "$recipients" <<EOF subject:$subject from:$from Example Message EOF
确保使用空白行将头部与身体分开,按照RFC 822。