I would like to understand why the following code does not send e-mails. I have checked both my inbox and spam folders on different e-mail addresses.
Here is contact.php
:
<?php
if($_POST["submit"]) {
$to = '[email protected]';
$subject = $_POST["subject"];
$message = $_POST["message"];
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
$thankYou="<p class=bg>Your message has been sent.</p>";
}
?>
<!DOCTYPE html>
<html><body>
<?=$thankYou ?>
<form method="post" action="contact.php">
<label>Subject:</label><input type="text" name="subject">
<label>Message:</label><textarea rows="5" cols="20" name="message"></textarea>
<input type="submit" name="submit">
</form></div></body></html>
The same script seemed to send e-mails without any problems a few hours ago.
I would highly appreciate if anyone could help or advise me.
Thank you.