Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Email form not working.

Featured Replies

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!

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

  • 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

  • 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.

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>

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.