Jump to content

Email form in PHP


Recommended Posts

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
Link to post
Share on other sites

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 by cyberRobot
Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.