Hi,
I have a bash script that used sendmail to send a simple e-mail...
-------------------------------------------------------------------------------- ---------------------------
DistributionList=`/usr/libexec/PlistBuddy -c "Print :EmailDistributionList" /Library/WebServer/Documents/server_settings.plist`;
MessageFile="/tmp/build_failure_email.txt";
if [ -e $MessageFile ];
then
rm $MessageFile
fi
#echo "To: $DistributionList" >> $MessageFile;
Subject="My Subject...";
echo "Subject: ${Subject}" >> $MessageFile;
FromName="My Name";
FromAddress="me@mydomain.com";
echo "From: $FromName <${FromAddress}>" >> $MessageFile;
echo "Message Body line 1..." >> $MessageFile;
echo "Message Body line 2." >> $MessageFile;
/usr/sbin/sendmail "$DistributionList" < $MessageFile
#/usr/sbin/sendmail -t "$DistributionList" < $MessageFile
-------------------------------------------------------------------------------- ---------------------------
When I run this script from the command line it works perfectly fine! No errors, and I get the e-mail, all is good in the world. Now If I have a webpage running out of /Library/WebServer/Documents and have a php file there that invokes the script, then it outputs the following error:
SendMail: fatal: Recipient addresses must be specified on the command line or via the -t option
Note, apache is running as an administrative user (the same user that I manually called the script from when it worked). As you can see I AM specifying the address on the command line, and I have also tried it with -t and putting the address in the file. But neither way works when the bash script is called from apache by way of the PHP script. I have spent hours trying to figure this out with no luck. Can anyone provide any pointers?
THANKS!
I have a bash script that used sendmail to send a simple e-mail...
-------------------------------------------------------------------------------- ---------------------------
DistributionList=`/usr/libexec/PlistBuddy -c "Print :EmailDistributionList" /Library/WebServer/Documents/server_settings.plist`;
MessageFile="/tmp/build_failure_email.txt";
if [ -e $MessageFile ];
then
rm $MessageFile
fi
#echo "To: $DistributionList" >> $MessageFile;
Subject="My Subject...";
echo "Subject: ${Subject}" >> $MessageFile;
FromName="My Name";
FromAddress="me@mydomain.com";
echo "From: $FromName <${FromAddress}>" >> $MessageFile;
echo "Message Body line 1..." >> $MessageFile;
echo "Message Body line 2." >> $MessageFile;
/usr/sbin/sendmail "$DistributionList" < $MessageFile
#/usr/sbin/sendmail -t "$DistributionList" < $MessageFile
-------------------------------------------------------------------------------- ---------------------------
When I run this script from the command line it works perfectly fine! No errors, and I get the e-mail, all is good in the world. Now If I have a webpage running out of /Library/WebServer/Documents and have a php file there that invokes the script, then it outputs the following error:
SendMail: fatal: Recipient addresses must be specified on the command line or via the -t option
Note, apache is running as an administrative user (the same user that I manually called the script from when it worked). As you can see I AM specifying the address on the command line, and I have also tried it with -t and putting the address in the file. But neither way works when the bash script is called from apache by way of the PHP script. I have spent hours trying to figure this out with no luck. Can anyone provide any pointers?
THANKS!