troubleshooting Question

PHP email form

Avatar of RNB
RNB asked on
Web Languages and StandardsPHPScripting Languages
13 Comments1 Solution273 ViewsLast Modified:
I have this little email script and I am not sure why its not working, I dont get an error on my pages after I submit the form. but the email is just not showing up in my email box I do use google apps if that matters at all. Hopefully someone could help me out:

this is the php on the action page.

	if(isset($_POST['submit'])) {
		$to = "";
		$subject = "A message from the website";
		$name = 'Name:' . $_POST['name'] . "\n";
		$company = 'Company:' . $_POST['company'] . "\n";
		$email = $_POST["email"] . "\n";
		$message = 'Message:' . $_POST['message'] . "\n";
		$headers = "FROM: {$email}\n";
		$headers .= "Reply-To: {$email}\n";
		$body = $name . $company . $email  . $phone . $message;
		if (mail($to, $subject, $body, $headers)) {
			$response = "Your message has been sent!";			
		} else {
			$response = "Ooops! something happened, please try again.";


this is the form on the contact page:
        <form name="contactform" method="post" action="mailer.php">
        <table class="forms">
                <td id="input"><input name="name" type="text" id="name" size="55" value="your name"/></td>
                <td id="input"><input name="company" type="text" id="company" size="55" value="your company"/></td>
                <td id="input"><input name="email" type="text" id="email" size="55" value="your email" /></td>
                <td id="input"><textarea name="message" cols="45" rows="12" id="message">your message...</textarea></td>
                <td align="right" class="submit_btn"><input name="submit" type="image" src="images/btn_send.png" /></td>

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros