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!
<?php
// Contact subject
$subject ="$subject";
// Details
$message="$detail";
// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";
// Enter your email address
$to ='slay.tiago@gmail.com';
$send_contact=mail($to,$subject,$message,$header);
// Check, if message sent to your email
// display message "We've received your information"
if($send_contact){
echo "We've received your contact information";
}
else {
echo "ERROR";
}
?>
This is a very simple form and I think that everything is correct, but when I test it at my host, although the success phrase appears (We've received your contact information) I don't receive nothing at my email, does anyone know where is the problem ?
Hi, if you are sending mail from localhost, then it will be not send.. And you have error in PHP code file, you need to use $_POST[''] to get the value from form. I have made changes in your code so just check out..
<?php
// Contact subject
$subject =$_POST['subject'];
// Details
$message=$_POST['$detail'];
// Mail of sender
$mail_from=$_POST["$customer_mail"];
// From
$header="from: $_POST['name'] <$_POST['mail_from']>";
// Enter your email address
$to ='slay.tiago@gmail.com';
$send_contact=mail($to,$subject,$message,$header);
// Check, if message sent to your email
// display message "We've received your information"
if($send_contact){
echo "We've received your contact information";
}
else {
echo "ERROR";
}
?>
Hi, i am using with html only and its working fine with me...
can you send me your php and html codes, so that i can review it and fine the exact error...
My host which is www.s2.com.pt if I use the contact form to send the form to my gmail it doesn't work, but if i do it to my s2.com.pt email (tiago@s2.com.pt) it works !
So the host can close sending the forms to the other emails other that the host itself ?