stublackett Posted June 3, 2008 Share Posted June 3, 2008 Hi, I've made a contact form, The E-Mail address that the form sends to is valid etc, But its just not sending to my E-Mail address The HTML code is <form method="post" action="contact.php" > <fieldset> <legend>Contact Details</legend> <ol> <li> <label for="name">Name :</label> <input name="name" type="text" class="text" id="name" size="35" /> </li> <li> <label for="email">Email address :</label> <input name="email" type="text" class="text" id="email" size="35" /> </li> <li> <label for="phone">Telephone Number :</label> <input name="phone" type="text" class="text" id="phone" size="35" /> </li> <li> <label for="fax">Fax Number :</label> <input name="fax" type="text" class="text" id="fax" size="35" /> </li> <li> <label for="address1">Address Line 1 :</label> <input name="address" type="text" class="text" id="address1" size="35" /> </li> <li> <label for="address2">Address Line 2 :</label> <input name="address2" type="text" class="text" id="address2" size="35" /> </li> <li> <label for="postcode">Post Code:</label> <input name="postcode" type="text" class="text" id="postcode" size="35" /> </li> <li> <label for="yourmessage">Your Message : </label> <textarea name="message" cols="33" rows="5" class="text" id="message"></textarea></ol> </fieldset> <fieldset class="submit"> <input class="submit" type="submit" value="Submit" /> <input class="reset" type="reset" /> </fieldset> </form> and the PHP That handles that form is <?php $to = "[email protected]"; $subject = "Alnwick Lodge Contact E-Mail"; $name = $_POST["name"]; $email = $_POST["email"]; $telephone = $_POST["phone"]; $fax = $_POST["fax"]; $address1 = $_POST["address"]; $address2 = $_POST["address2"]; $postcode = $_POST["postcode"]; $message = $_POST["message"]; $messagesent = "From: $name Message: $message"; $from = $_POST["email"]; $headers = "From: $from"; mail($to,$subject,$messagesent,$headers); echo "Your message has been sent to the webmaster, thank you."; ?> Can anyone see any reason why this isnt working? ??? ??? Link to comment https://forums.phpfreaks.com/topic/108530-contact-form/ Share on other sites More sharing options...
kbh43dz_u Posted June 3, 2008 Share Posted June 3, 2008 do you get an error message? try a the mail() function alone and enter the values manually. -> It can be that the mailserver (mail() sends with) is blacklisted by your mail provider. Link to comment https://forums.phpfreaks.com/topic/108530-contact-form/#findComment-556469 Share on other sites More sharing options...
stublackett Posted June 3, 2008 Author Share Posted June 3, 2008 No error message, Apologies for not saying that I get the echo of "Message sent to webmaster" when it blatently hasnt..... I've used this exact script before and it worked then, But not this time Link to comment https://forums.phpfreaks.com/topic/108530-contact-form/#findComment-556471 Share on other sites More sharing options...
kbh43dz_u Posted June 3, 2008 Share Posted June 3, 2008 mail() returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. your echo will be shown in any case (except there is an syntax error...). change your echo to this: $result = mail($to,$subject,$messagesent,$headers); if($result){ echo "Your message has been sent to the webmaster, thank you."; } edit: also check if your variables are not empty before you send the mail. Link to comment https://forums.phpfreaks.com/topic/108530-contact-form/#findComment-556479 Share on other sites More sharing options...
stublackett Posted June 3, 2008 Author Share Posted June 3, 2008 mail() returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. your echo will be shown in any case (except there is an syntax error...). change your echo to this: $result = mail($to,$subject,$messagesent,$headers); if($result){ echo "Your message has been sent to the webmaster, thank you."; } edit: also check if your variables are not empty before you send the mail. Still no joy with that, I'm afraid I've echoed out the variables to see if their sending over and they definatley are, It just seems that its that mail function thats not doing the job Unless I all of a sudden get 6 or 7 e-mails from trying Link to comment https://forums.phpfreaks.com/topic/108530-contact-form/#findComment-556484 Share on other sites More sharing options...
kbh43dz_u Posted June 3, 2008 Share Posted June 3, 2008 then you simply have a delay emails have to run through lots of security/virus/... checks before they arrive. Link to comment https://forums.phpfreaks.com/topic/108530-contact-form/#findComment-556488 Share on other sites More sharing options...
stublackett Posted June 3, 2008 Author Share Posted June 3, 2008 then you simply have a delay emails have to run through lots of security/virus/... checks before they arrive. How long should that delay be though ??? ??? Think its been a good 15 minutes + and still nothing through Link to comment https://forums.phpfreaks.com/topic/108530-contact-form/#findComment-556491 Share on other sites More sharing options...
jonsjava Posted June 3, 2008 Share Posted June 3, 2008 Have you checked your spam folder. Googlemail checks reverse entries, and if your server isn't authorized to send that mail, it puts it in the spam can. Link to comment https://forums.phpfreaks.com/topic/108530-contact-form/#findComment-556503 Share on other sites More sharing options...
stublackett Posted June 3, 2008 Author Share Posted June 3, 2008 Nothing in the spam folder either I'm going to try changing the E-Mail address, Cant see any reason at all why this shouldnt work ??? Link to comment https://forums.phpfreaks.com/topic/108530-contact-form/#findComment-556518 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.