Email Submission form not working
So I am basically trying to create a simple photography portfolio website, and decided to put in a contact page as well. Right now I am trying to build a basic email submission form with php but when I inputted the values in the webpage the values disappeared, but I did not receive any emails. I was wondering if the cause is some error in my code, or if I have to turn the webpage into a website for it to send emails.
For furthermore information: I am using xampp to test out the php code and my file directories are: C:xampphtdocs and inside the htdocs is a folder called "Photo Website" which has all my webpages, and images.
I ran it through localhost using http://localhost/Photo%20Website/Contact.php and got
Warning : mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:xampphtdocsPhoto WebsiteContact.php on line 46
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js">
</script>
<link rel="stylesheet" type="text/css" href="webpage.css">
</head>
<div id="nav">
<ul>
<li><a href="Contact.php"> Contact </a></li>
<li><a href="AboutMe.html"> About Me </a></li>
<li><a href="Business.html"> Business </a></li>
<li><a href="Street.html"> Street </a></li>
<li><a href="Nature.html"> Nature </a></li>
</ul>
<p id="logo"><a href="webpage.html"> Icyportraitsgta </a></p>
</div>
<div id="description">
<!-- Creating the contact forms using HTML !-->
<form method="post" name="emailform" action="Contact.php">
Enter Name: <input type="text" name="name"> <br>
Enter Email: <input type="text" name="email"> <br>
Message: <textarea name="message"></textarea> <br>
<input type="submit" value="Send">
</form>
<!-- Assigned variables using php and used POST !-->
<?php
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];
?>
<!-- Using the above php variables to compose an email message !-->
<?php
$email_from = 'alihaider2011@live.ca';
$email_subject = "New Form submission";
$email_body = "You have received a new message from the user $name.n".
"Here is the message:n $message";
?>
<!-- php code to send the email !-->
<?php
$to = "dutchland2013@hotmail.com";
$headers = "From: $email_from rn";
$headers = "Reply-To: $visitor_email rn";
mail($to, $email_subject,$email_body, $headers);
?>
</div>
</body>
</html>
链接地址: http://www.djcxy.com/p/69718.html
上一篇: yii关系数据网格部件
下一篇: 电子邮件提交表单无效