So, having used a template to create a simple company website, I included the "contact us" php, called "form.php" (code below).
When the form is completed, and the "Send" button is pressed, the response from the site is "Email has been sent". The problem is that nothing ever arrives!
I've been in touch with GoDaddy, who say that everything is good on their end, but they will not look at the code of my php. They uploaded a test php onto my site, and sent emails that were successfully received.
I'm completely lost on this, and cannot seem to see the issue, so any help would be greatly appreciated.
CODE>>>>>
<?php
$mail->SMTPDebug = 0;
$mail->Host = 'localhost';
$mail->Port = 25;
$mail->ssl = false;
$mail->authentication = false;
$to = 'steev@myemail.com';
$subject = 'Website Enquiry';
$from = $_POST['email'];
$headers = 'From: (mywebsite.net)' . "\r\n" . 'Content-type: text/html; charset=utf-8';
$message = '
<html>
<head>
<title>website Contact Form</title>
</head>
<body>
<h3>Name: <span style="font-weight: normal;">' . $_POST['name'] . '</span></h3>
<h3>Email: <span style="font-weight: normal;">' . $_POST['email'] . '</span></h3>
<div>
<h3 style="margin-bottom: 5px;">Comment:</h3>
<div>' . $_POST['comment'] . '</div>
</div>
</body>
</html>';
if (!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['comment'])) {
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
mail($to, $subject, $message, $headers) or die('<span class="text-danger">Error sending Mail</span>');
echo '<span class="text-success send-true">Your email was sent!</span>';
}
} else {
echo '<span class="text-danger">All fields must be filled!</span>';
}
?>