Hi everyone,
I've created a website with a simple form that when filled in sends the information in a form of an email to the specified email address.
For some reason I don't seem to be receiving emails anymore at all whereas i used to be able to get them, i've tested it myself by entering dummy info and submiting, yet I still don't get anything. All problem I can think of is that I accidentally changed the code in the past month or two, but I can't seem to find what's wrong. Please someone help, the code for the form and the php is here:
form:
<form id="theForm" name="theForm" method="post" onsubmit="return formValidating();" action="sendTo.php"> <p> Full name: </p> <input type="text" name="theName" id="theName" placeholder="Your name"/> <p> Email address: </p> <input type="email" name="emailAddress" id="emailAddress" placeholder="Eg, me@thePlace.net" /> <p> Contact number: </p> <input type="text" name="theNumber" id="theNumber" placeholder="tel"/> <p> Area: </p> <input type="text" name="theArea" id="theArea" placeholder="Your area"/> <p> Description (photoshoot details): </p> <textarea name="theDescription" id="theDescription" placeholder="tel" rows="10" cols="30"> </textarea> <br/> <br/> <input type="submit" value="Send" id="submitButton" /> </form>
PHP "sendTo.php"
<?php $name = $_POST['theName']; $visitor_email = $_POST['emailAddress']; $number = $_POST['theNumber']; $area = $_POST['theArea']; $description = $_POST['theDescription']; $email_from = 'info@luketannous.com'; $email_subject = "LT Photography New Form submission"; $email_body = "You have received a new message from the user: ".$name."\n \n His email address: ".$visitor_email ."\n His contact details: ". $number ."\n His area: ". $area ."\n Photoshoot Description : ". $description ." \n". $to = "donnierisk@gmail.com"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; $success = mail($to,$email_subject,$email_body,$headers); if($success){ echo "<div style='height:200px'> </div><p style='text-align:center;margin:auto;'>Your e-mail has been sent succesfully.</p> "; echo "<p style='text-align:center;margin:auto;'> <br/>Automatically redirecting you back to the home page...</p> "; header( "refresh:5;url=index.html" ); } else{ echo "<div style='height:200px'> </div><p style='text-align:center;margin:auto;'>Your email failed to send, please try again or contact me via telephone</p> "; echo "<p style='text-align:center;margin:auto;'>Click <a href='contact.html'> here </a> to go back to the contact page</p> "; } ?>
Note that I have omitted irrelevant code (html tags, etc).
The submit button works, because the page comes up with the if($success) part, you can check here to see for yourself: http://www.luketannous.co.za/contact.html
Hope someone can help me with this simple and embarrassing problem.