I'm not receiving emails from my contact form on my website and not sure how to fix this? The website is hosted on Microsoft Azure. How would I go about resolving this?
The code I currently have is:
<?php
if (isset($_POST['contact_name']) && isset($_POST['contact_email'])
&& isset($_POST['contact_text'])) {
$contact_name = $_POST['contact_name'];
$contact_email = $_POST['contact_email'];
$contact_text = $_POST['contact_text'];
if(!empty($contact_name) && !empty($contact_email) && !empty($contact_text)) {
$to = 'email@domain.com';
$subject = 'Message from website.';
$body = $contact_name."
".$contact_text;
$headers = 'From: ' .$contact_email;
if(@mail('email@domain.com', $contact_text, $body, $headers)) {
echo 'Thank you';
} else {
echo 'error.';
}
}
else {
echo 'You're missing something';
}
}
?>
<form action="" method="POST">
Name: <input type="text" name="contact_name">
Email: <input type="text" name="contact_email">
Message: <textarea name="contact_text" rows="5" cols="20"></textarea>
<input type="submit" value="Send">
</form>
Thank you.