APC Posted May 4, 2008 Share Posted May 4, 2008 Hi, I am using the following form on my website to allow the users to send an email directly to my account. The PHP code seems fine to me, yet it isn't working. When I press send I am being taken to that page called "thankhyou.html" which implies to me that the email has been sent, yet I am not receiving any emails. I have tried using a different email address, yet this makes no difference. I have also tried hosting the pages on another server WHICH I KNOW FOR SURE IS COMPATIBLE WITH THE LATEST PHP. Still I have had no luck. Does anyone have any ideas? <form action="mail.php" method="POST"> <table> <tr><td>Name: </td><td><input type="text" name="name"></td></tr> <tr><td>Email: </td><td><input type="text" name="email"></td></tr> <tr><td>Subject: </td><td><input type="text" name="subject"></td></tr> <td>Message: </td><td><textarea style="width: 200px; height: 90px; " name="message"></textarea></td> <td colspan="2"><input type="submit" value="Send"></td> <td colspan="2"><input type="reset" value="Reset"></td></tr> </table> </form> <?php if(isset($_POST['name'])) { $name = $_POST['name'] . "\n"; $email = $_POST['email'] . "\n"; $subject = $_POST['subject'] . "\n"; $messageorig = $_POST['message'] . "\n"; $message = "Name: $name " . "\n"; $message .= "Email: $email " . "\n"; $message .= "Message: $messageorig " . "\n"; if(mail("root@heathfieldresidentialhome.co.uk", $subject, $message, "From: Contact Form")) { header("Location: thankyou.html"); } else { echo "Mail sending failed"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/104127-problems-with-an-html-form/ Share on other sites More sharing options...
DarkWater Posted May 4, 2008 Share Posted May 4, 2008 if (mail()) isn't an accurate representation of whether or not the email actually went through, it just returns the success of the function call. There's no easy way to test that an email went through in PHP. >_> Quote Link to comment https://forums.phpfreaks.com/topic/104127-problems-with-an-html-form/#findComment-533111 Share on other sites More sharing options...
DeanWhitehouse Posted May 5, 2008 Share Posted May 5, 2008 is the host allowing out going mail?? not all do, if there not free. Quote Link to comment https://forums.phpfreaks.com/topic/104127-problems-with-an-html-form/#findComment-533116 Share on other sites More sharing options...
APC Posted May 5, 2008 Author Share Posted May 5, 2008 Yes, it's a paid host which allows this function. Quote Link to comment https://forums.phpfreaks.com/topic/104127-problems-with-an-html-form/#findComment-533447 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.