I'm running a server from my home computer to test php code I write before uploading it online.
The mail() function is not working, meaning I'm not getting any emails when the form is submitted.
I tried it online, and instead of saying Mail NOT Sent, it says mail sent, so obviously that has something to do with the mail server not being on my computer, but I'm
still not getting any mail!!!
This is so frustrating! What do I need to do to recieve mail?? Please help!
This is the script for reference:
Code: Select all
<?php
$subject = 'Abduction Report';
$to = 'ice52us@gmail.com';
$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
$howMany = $_POST['howmany'];
$when = $_POST['whenithappened'];
$howLong = $_POST['howlong'];
$description = $_POST['description'];
$beer = $_POST['beer'];
$fang = $_POST['fangspotted'];
$email = $_POST['email'];
$whatTheyDid = $_POST['whattheydid'];
$other = $_POST['other'];
$msg = "$name was abducted $when and was gone for $howLong.\n" .
"The aliens were $description and were all drinking $beer.\n" .
"There were $howMany and they $whatTheyDid.\n" .
"Was Fang there? $fang.\n" .
"Other Comments: $other";
mail($to, $subject, $msg, 'From:' . $email);
echo 'Thank you for submitting the form, ' . $name . '<br>';
echo 'You were abducted ' . $when;
echo ' and were gone for ' . $howLong . '<br>';
echo 'Describe them: ' . $description;
echo ' and they were all drinking ' . $beer . '<br>';
echo 'There was ' . $howMany . ' and they ' . $whatTheyDid . '<br>';
echo 'Was Fang there? ' . $fang . '<br>';
echo 'Your email address is: ' . $email;
echo '<br>';
if (mail($to, $subject, $msg)) {
echo 'Mail Sent to ' . $to;
} else {
echo 'Mail NOT Sent';
}
?>