考虑下面的PHP代码:邮件()不能正常工作
<html>
<body>
<?php
$fname ="First Name = ".$_REQUEST['fname']."\n";
$lname ="Last Name = ".$_REQUEST['lname']."\n";
$breakfast = "Desired Breakfast = ".$_REQUEST['breakfast']."\n";
$floor ="Desired Floor = ".$_REQUEST['floor']."\n";
$to = "[email protected]";
$email="[email protected]";
$subject="shenkar php form from erez geva site";
$body =$fname.$lname.$breakfast.$floor;
if (mail($to, $subject, $body, "From: $email")){
header("Location: http://localhost:9090/sent.html");
exit();
}else{
echo("<p>Message delivery failed...</p>");
}
?>
</body>
</html>
不工作。 用户从中选择所需选项的索引HTML文件写得很好(向我授教授),所以让我们假设问题在别处。 如果我直接去那个php文件:本地主机\ send.php我得到这个错误:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\send.php on line 12
什么是它的meanning?
**我正在使用Wamp 2.2e – user2162550
那么,让我们来看看...你有一个运行在本地主机上的邮件服务器并且监听端口25吗? – Jon
这是因为邮件不能从本地主机发送,除非你有一个正确配置的邮件服务 – Fabio