Tuesday, 18 December 2018

xhtml - php simple contact form not sending mail even after confirmation

I have been trying to get a php contact form working on my portfolio site (currently on a free megabyet.net account), but on testing it(on the uploaded site) even though i get the thankyou/confirmation message, I still don't receive any message on my mail account (specified in the code), I can't seem to understand the problem here....help needed!




can it be something related to SMTP??






Here's the code :



if(isset($_POST['submit'])) {


$to = "vishu_unlocker@yahoo.com";
$subject = "Portfolio Contact";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$headers = "From: $email_field";
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";

echo "Mail has been sent, thankyou!";
mail($to, $subject, $body, $headers);


} else {

echo "blarg!";

}
?>


HTML Code:





Name :




E-Mail Address :




Message :










No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...