html - Email form .php script error -
i have script email form inside, have .php script supposed send inputs in form email. problem when submit form, error seen below:
warning: mail(): failed connect mailserver @ "127.0.0.1" port 25, verify "smtp" , "smtp_port" setting in php.ini or use ini_set() in c:\program files (x86)\easyphp-devserver-14.1vc11\data\localweb\scripts\supformsend.php on line 16
html script:
<form action="supformsend.php" method="post" id="contactforms"> <div id="namelabelform"> <label for="name">name:</label><br> <input type="text" id="nameinput" name="nameinput"/> </div> <div id="emaillabelform"> <label for="mail">e-mail:</label><br> <input type="email" id="mailinput" name="mailinput"/> </div> <div id="messagelabelform"> <label for="msg">support message:</label><br> <textarea id="messageinput" name="messageinput"></textarea> </div> <div class="submitemailbutton"> <button type="submit" id="submitbutton">send message</button> </div> </form>
php script:
<?php $field_name = $_post['nameinput']; $field_email = $_post['mailinput']; $field_message = $_post['messageinput']; $mail_to = 'removed safety'; $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 = 'contact.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('message failed. please, send email to'); window.location = 'contact.html'; </script> <?php } ?>
the error complaining trying send email through local smtp server doesn't exist. if running own smtp server fix server or if not need point php smtp server using ini_set() or edit php.ini indicated in error message before calling mail().
ex:
ini_set("smtp", "mail.example.com"); ini_set("sendmail_from", "test@example.com"); ini_set("smtp_port", "25");
Comments
Post a Comment