croz27 Posted September 19, 2010 Share Posted September 19, 2010 Hi Y'all I have a contact form page with a contact-handler.php for emailing the details to my email address. I have the site uploaded on the net for the php and submission of the message fields to work and it seems to submit the message fine (simple contact form... name, email and message) but i never receive the email of the users message?? I have searched this forum before i posted this and there was one message on this topic however i could not make sense of the reply.. guy typs lke this lnguage wit misn words? madness. Anyways i know a guy mentioned gmail and yahoo might be backlist but surely not for days? the email is not in my spam folder either.. heres the snippet of my code, massively appreciate any help. <?php $errors = ''; $myemail = '[email protected]'; if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) { $errors .= "\n Error: all fields are required"; } $name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; if (!eregi( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email_address)) { $errors .= "\n Error: Invalid email address"; } if( empty($errors)) { $to = $myemail; $email_subject = "Contact form submission: $name"; $email_body = "You have received a new message. ". " Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message"; $headers = "From: $myemail"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); //redirect to the 'thank you' page header('Location: contact-form-thank-you.html'); } ?> Thanks for any input. ps. I have left in my real email address incase gmail has any conflicts with this ... croz27 Quote Link to comment https://forums.phpfreaks.com/topic/213797-php-form-handler-help/ Share on other sites More sharing options...
croz27 Posted September 19, 2010 Author Share Posted September 19, 2010 anyone ? Quote Link to comment https://forums.phpfreaks.com/topic/213797-php-form-handler-help/#findComment-1112751 Share on other sites More sharing options...
fortnox007 Posted September 19, 2010 Share Posted September 19, 2010 Can you maybe leave that (header location) out of your code and test it, If your not sending mail, I assume you will get a specific error (which shows on the initial page) The error stuff your testing now only checks if what the users inputs is valid, but what you want to know also if your able to sent mail even if that's correct. Quote Link to comment https://forums.phpfreaks.com/topic/213797-php-form-handler-help/#findComment-1112754 Share on other sites More sharing options...
croz27 Posted September 19, 2010 Author Share Posted September 19, 2010 Hi, First of all thanks very much for your reply, any help is very appreciated as this is killing my brain! I took the location out and recieved no error and still no email... any other ideas? It seems to function properly and i thought it may be my gmail stopping it but i get no email even in the spam folder. Thanks, croz27 [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/213797-php-form-handler-help/#findComment-1112766 Share on other sites More sharing options...
void Posted September 19, 2010 Share Posted September 19, 2010 $headers = "From: $myemail\r\n"; $headers .= "Reply-To: $email_address\r\n"; Quote Link to comment https://forums.phpfreaks.com/topic/213797-php-form-handler-help/#findComment-1112771 Share on other sites More sharing options...
croz27 Posted September 19, 2010 Author Share Posted September 19, 2010 Thanks Void! Legend. Have a good day! Quote Link to comment https://forums.phpfreaks.com/topic/213797-php-form-handler-help/#findComment-1112772 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.