sigmahokies Posted December 17, 2015 Share Posted December 17, 2015 Hi everyone Happy Holiday to everyone!!! I am trying to create the form contact in PHP. I created form contact in html, But next page - I'm not sure it is right script in PHP to send email to my gmail account. I asked the hosting company to see if their server can send email to my gmail account, they said yes, should be. So, I create script in PHP, I don't know if it is right script, i hope you will find something missing in this script. I followed exactly from website, I tested to send then I checked my gmail account, this email has not sent. Can you help? Here my script: <?phpif (isset($_POST['submitted'])) {$name = $_POST['name'];$email = $_POST['email'];$select = $_POST['select'];$text = $_POST['text'];} $to = "xxxxxxx@gmail.com";$subject = "ASL class";$message = "Message is from ".$name.".\n The type class is ".$select.".\n The message said: ".$text; mail($to,$subject,$message); echo "<p>Sent! Thank you for fill an E-mail form</p>";?> Thank you in advanced, Gary Quote Link to comment https://forums.phpfreaks.com/topic/299812-email-form-in-php/ Share on other sites More sharing options...
cyberRobot Posted December 17, 2015 Share Posted December 17, 2015 (edited) Having you tried adding a From header? More information can be found under the "additional_headers" option here: http://php.net/manual/en/function.mail.php See the second note under that section. Also, is PHP set to show all errors and warnings? To do so, you could add the following to the top of your script during the debugging process: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Edited December 17, 2015 by cyberRobot Quote Link to comment https://forums.phpfreaks.com/topic/299812-email-form-in-php/#findComment-1528134 Share on other sites More sharing options...
sigmahokies Posted December 18, 2015 Author Share Posted December 18, 2015 I put your code in above of my script, there is no error warning message on site. Quote Link to comment https://forums.phpfreaks.com/topic/299812-email-form-in-php/#findComment-1528166 Share on other sites More sharing options...
ginerjm Posted December 18, 2015 Share Posted December 18, 2015 Read the manual to see how you should be writing the mail() call. You're missing something. Quote Link to comment https://forums.phpfreaks.com/topic/299812-email-form-in-php/#findComment-1528171 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.