I am using 000webhost webmail to receive emails using contact form but its not working.
contact.php
<form action="mailer.php" method="post">
<p>Name:</p>
<input type="text" name="name" />
<p>E-mail:</p>
<input type="text" name="email" />
<p>Subject:</p>
<input type="text" name="subject" />
<p>Message:</p>
<textarea name="message"></textarea></p>
<input class="send" type="submit" value="Send" name="submit">
</form>
mailer.php
<?php
$to = "[email protected]";
$subject = "Support requested by ".$_POST['name'];
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$headers = 'From: '.$_POST['email'].'' . "\r\n" .
'Reply-To: '.$_POST['email'].'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$body = $message;
@mail($to, $subject, $body, $headers );
header( 'Location:thankyou.php' ) ; //replace with landing page.
?>
Nothing wrong with your html I tried it. If you have chrome you can use the developer tool to debug and see if your requests are sent and if they are lending on the correct path :
In your mailer.php output the $_POST
variable to make sure your data is landing there correctly,
echo "<pre>";
var_dump($_POST);
echo "</pre>";
You may also need to validate your html :
<form action="mailer.php" method="post">
<p>Name:</p>
<input type="text" name="name" >
<p>E-mail:</p>
<input type="text" name="email" >
<p>Subject:</p>
<input type="text" name="subject" >
<p>Message:</p>
<textarea name="message"></textarea>
<input class="send" type="submit" value="Send" name="submit">
</form>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With