I have a simple php script that uses the mail function, and all seems to work, but the email it sends never turns up. I've search stacks of sites, but I can't seem to find anything that works. The server is running php5 and phpsuexec. My script is:
Code: Select all
<?php
if (isset($_GET['do'])) {
$sign_up_button = false;
$task = $_GET['do'];
switch ($task) {
case "send" : echo "<p class=sent>Thanks for your enquiry, it has been emailed to us. We will respond as soon as possible.</p>";
//start building the mail string
$msg = "Name: $_POST[name]\r\n";
$msg .= "Email: $_POST[email]\r\n";
$msg .= "Phone: $_POST[phone]\r\n";
$msg .= "Message: $_POST[message]\r\n";
//set up the mail
$recipient = "emailaddress@goeshere"; //obviously this has been changed
$subject = "** $_POST[subject] **";
$mailheaders = "From: $_POST[name] <$_POST[email]>\r\n";
$mailheaders .= "Reply-To: $_POST[email]\r\n";
$mailheaders .= "MIME-Version: 1.0\r\n";
//send the mail
mail($recipient, $subject, $msg, $mailheaders);
break;
default : //do nothing
break;
}
}
else {
//do nothing
}
?>