Contact php form not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
highdemanddesign
Forum Newbie
Posts: 4
Joined: Thu Jan 22, 2009 4:15 pm

Contact php form not working

Post by highdemanddesign »

I have a contact form that sends a user's information to an email. It is hosted through yahoo and they require that the FROM be from an address from our domain. When you submit the form, it says it sent successfully, but no email ever arrives. Is there something in this code i'm missing? Thanks for your help.

Code: Select all

 
<?
$subject="from ".$_GET['your_name'];
$headers= "From: angie@focusadmin.com";
 $headers.='Content-type: text/html; charset=iso-8859-1';
mail("angie@focusadmin.com", $subject,  "
<html>
<head>
 <title>Contact letter</title>
</head>
<body>
 
<br>
  ".$_GET['message']."<br>
   ".$_GET['your_name']."<br>
   ".$_GET['your_phone']."<br>
   ".$_GET['your_address']."<br>
</body>
</html>" , $headers);
echo ("Your message was successfully sent!");
?>
<script>
    resizeTo(300, 300)
    //window.close()
</script>
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Contact php form not working

Post by Benjamin »

You need new lines after the headers, that would be the first thing to fix:

Code: Select all

 
$headers = "From: angie@focusadmin.com\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
 
Also check the parameters of the mail function to verify they are correct.
highdemanddesign
Forum Newbie
Posts: 4
Joined: Thu Jan 22, 2009 4:15 pm

Re: Contact php form not working

Post by highdemanddesign »

That did it!! thank you thank you thank you!!
Post Reply