I have been struggling with the mail function. I've tried various configurations of the sendmail_path in php.ini on our server and currently have it set to:
sendmail_path=/usr/sbin/sendmail -t -i
I run the script but recieve no mail
also tried /usr/sbin/sendmail -io -t
which results in the following message:
/etc/sendmail.cf: line 0: cannot open: Permission denied
As suggested on PHP.net I have specified all required headers and have echo'd them as well to ensure they are coming through
$myname = "Me";
$myemail = "$_POST[email]";
$contactname = "$_POST[name]";
$contactemail = "$_POST[to]";
$message = "$_POST[message]";
$subject = "$_POST[subject]";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <".$myemail.">\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
echo $contactemail." ".$subject." ".$message." ".$headers." ".$myemail;
mail($contactemail, $subject, $message, $headers);
echo "Email sent";
P.S. this all works locally on windows?
I'd be grateful of any suggestions.
Sean