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="Subject"
from="user@example.com"
recipients="user1@mail.example user2@mail.example"
mail="subject:$subject\nfrom:$from\nExample Message"
And the actual sending:
echo -e $mail | /usr/sbin/sendmail "$recipients"
The problem is that only user2@mail.example
is receiving the email. How can I change this so all the recipients receive the email?
NOTE: The solution has to be with sendmail, I'm using jailshell and it seems to be the only available method