php - Not receiving the mail -
i want create contact form using php mailing function. learning process developing on free web hosting provider. here files:
index.html
<!doctype html> <html> <head> <meta charset="utf-8"> <title>html5 contact form</title> <link rel="stylesheet" media="screen" href="styles.css"> </head> <body> <div id="contact"> <form class="contact_form" action="contact.php" method="post" name="contact_form"> <ul> <li> <h2>contact us</h2> <span class="required_notification">* denotes required field</span> </li> <li> <label for="name">name:</label> <input type="text" id="name" name="name" placeholder="john doe" required /> </li> <li> <label for="email">email:</label> <input type="email" name="email" id="email" placeholder="john_doe@example.com" required /> <span class="form_hint">proper format "name@something.com"</span> </li> <li> <label for="message">message:</label> <textarea name="message" id="message" cols="40" rows="6" required></textarea> </li> <li> <button class="submit" id="submit_btn" type="submit">submit form</button> </li> </ul> </form> </div> </body> </html>
contact.php
<?php $field_name = $_post['name']; $field_email = $_post['email']; $field_message = $_post['message']; $mail_to = 'babloopuneeth@gmail.com'; $subject = 'message site visitor '.$field_name; $body_message = 'from: '.$field_name."\n"; $body_message .= 'e-mail: '.$field_email."\n"; $body_message .= 'message: '.$field_message; $headers = 'from: '.$field_email."\r\n"; $headers .= 'reply-to: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('thank message. contact shortly.'); window.location = 'sample.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('message failed. please, send email gordon@template-help.com'); window.location = 'sample.html'; </script> <?php } ?>
i have styles.css file. i'm getting alert box saying thank message
. i'm not getting mail.
can me? going wrong?
does hosting service block port 25? have tested on server , works perfectly.
if using 000webhost does. common free service , removed support mail while back.
Comments
Post a Comment