I'm just tinkering with PHP and learning the basics ; all well and good
so far, except I can't get mail() to work.
I'm running Apache 2 & PHP 4.3.9, and ssmtp on Gentoo. ssmtp is set up
correctly (I can use "sendmail" in evolution fine).
When I post from PHP it seems to work ok except it's emailed to
ap****@autismuk.freeserve.co.uk (according to my log). I've tried setting
the sendmail directory option in php.ini to /usr/lib/sendmail & that
doesn't work either..... I'm mystified.
Am I doing something obviously wrong ?
Any ideas ?
<?php
$msg = "Name: $_POST[name]\n";
$msg .= "E-Mail: $_POST[email]\n";
$msg .= "Message: $_POST[message]\n";
$recipient = "au******@autismuk.freeserve.co.uk";
$subject = "Form submission results";
$mailheaders = "From: My Web Site <au******@autismuk.freeserve.co.uk> \n";
$mailheaders = "Reply-To: $_POST[email]";
$mailheaders = ""; // this line in or out makes no odds ....
mail($recipient,$subject,$msg,$mailheaders) or die("Failed to send");
print "Message sent successfully.<br>";
?>