ChristianToney Posted August 9, 2014 Share Posted August 9, 2014 I recently decided to have the data from the forms that were filled out not only emailed to me but to the person filling the form out for conf. When the form is finished and the person hits submit every comes up with the success and the data gets logged on the server but the emails never send out. Any help is much appreciated. Here is the code: <?php $name = $_POST["First"]; $Last_name = $_POST["Last"]; $Age = $_POST["Age"]; $Height = $_POST["Height"]; $Weight = $_POST["Weight"]; $Eye_Color = $_POST["Eye"]; $Hair = $_POST["Hair"]; $Glasses_or_Contacts = $_POST["Glasses_or_Contacts"]; $Customer_Email = $_POST["Contact_Email"]; $email_from ='WEBMASTEREMAIL@gmail.com'; $email_subject = "Form completion Email"; $email_body = $name . $Last_name . $Age . $Height . $Weight $Eye_Color . $Hair . $Glasses_or_Contacts . $Customer_Email; $to = 'CUSTOMEREMAIL@gmail.com, WEBMASTEREMAIL@gmail.com'; $headers = "From: $email_from rn"; if(!mail($to,$email_subject,$email_body)) { echo 'failed'; } else { echo 'sent'; } ?> All emails were replaced in caps. btw And yes I have checked spam and still nothing is sent. Link to comment Share on other sites More sharing options...
niche Posted August 10, 2014 Share Posted August 10, 2014 (edited) what errors are you getting? EDIT: worked for me: <?php$name = "niche";$email_from ='niche@xyz.com';$email_subject = "Form completion Email";$email_body = $name; $to = 'niche@xyz.com';$headers = "From: $email_from rn"; if(!mail($to,$email_subject,$email_body)) { echo 'failed';} else { echo 'sent';}?> Edited August 10, 2014 by niche Link to comment Share on other sites More sharing options...
justsomeguy Posted August 11, 2014 Share Posted August 11, 2014 You're not including the headers, maybe something is blocking the email based on the default from address. Link to comment Share on other sites More sharing options...
ChristianToney Posted August 13, 2014 Author Share Posted August 13, 2014 Sorry for the long reply. I'm not receiving any error its just the email never gets to the client or me. Link to comment Share on other sites More sharing options...
guruparthi Posted August 20, 2014 Share Posted August 20, 2014 This is the correct format for send mail in PHP <?php $to='example@gmail.com'; $subject='Send mail using php'; $message='This mail send using php'; $headers='From: guruparthiban19@gmail.com'; $mail=mail($to,$subject,$message,$headers); if($mail) { echo'Mail send successfully'; } else { echo'Mail is not send'; } ?> Your email address may be wrong. The email id should be lowercase. It may be cause errors. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now