从多个收件人的bash脚本使用sendmail

我正在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

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...