November 14, 200817 yr Hey guys. I have been working on this email form. Everything seems to work great except I don't get any emails haha. Here is the code. <?php $emailSubject = 'contact and dealer'; $sendTo = '*****@gmail.com'; $nameField = $_POST['name']; $companyField = $_POST['company']; $emailField = $_POST['email']; $commentsField = $_POST['comments']; $body = <<<EOD <br><hr><br> Name: $name <br> Company: $company <br> Email: $email <br> Comments: $comments <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($emailSubject, $sendTo, $body, $headers); ?> Thanks guys!
November 14, 200817 yr Hey guys. I have been working on this email form. Everything seems to work great except I don't get any emails haha. Here is the code. <?php $emailSubject = 'contact and dealer'; $sendTo = '*****@gmail.com'; $nameField = $_POST['name']; $companyField = $_POST['company']; $emailField = $_POST['email']; $commentsField = $_POST['comments']; $body = <<<EOD <br><hr><br> Name: $name <br> Company: $company <br> Email: $email <br> Comments: $comments <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($emailSubject, $sendTo, $body, $headers); ?> Thanks guys! hi try $success = mail($sendTo,$emailSubject, $body, $headers); i always put the send first so if that doesnt work check that you have redirected youe web mail address to your pearsonal email address and that your server allows the mail function i think some have to have send_mail function god luck
November 17, 200817 yr Author hi try $success = mail($sendTo,$emailSubject, $body, $headers); i always put the send first so if that doesnt work check that you have redirected youe web mail address to your pearsonal email address and that your server allows the mail function i think some have to have send_mail function god luck Thanks for the help. I will try that out. I also did have the email routed correctly. My host is GoDaddy and I heard they had all of that setup. I will double check though. Thanks again
November 18, 200817 yr Author Woo!!!! Putting the $sendTo in front worked. Why is that? Lol, doesn't make any sense to me. I'm new at this PHP thing haha. Oh yeah, the email reads like this: Name: Company: Email: Comments: None of the info I put in there worked. Edit: Uhhh...someone told me to put the variable to $nameField and then in another place have it just $name. Didn't make sense to me. I tried changing the variables and retesting the form. Now it doesn't email. Changed everything back and it still didn't send the email...err.
November 18, 200817 yr Change this part of your code Name: $name <br> Company: $company <br> Email: $email <br> Comments: $comments <br> to this Name: $nameField <br> Company: $companyField <br> Email: $emailField <br> Comments: $commentsField <br>
November 19, 200817 yr Author Change this part of your code Name: $name <br> Company: $company <br> Email: $email <br> Comments: $comments <br> to this Name: $nameField <br> Company: $companyField <br> Email: $emailField <br> Comments: $commentsField <br> Alright, that is what I did then the form stopped working. It wasn't the form though. I think it was the server because I just got 6 emails. I tried different email accounts and they weren't working. Must have been the server. Anyways, why did switching the "$sendTo" to the front make a difference?
Create an account or sign in to comment