PHP mail函数

 

 书本上的代码:

 

<?php
  //create short variable names
  $name=$_POST['name'];
  $email=$_POST['email'];
  $feedback=$_POST['feedback'];

  //set up some satatic information
  $toaddress="[email protected]";

  $subject="Feedback from web site";

  $mailcontent="Customer name:".$name."\n".
      "Customer email:".$email."\n".
      "Customer comments:\n".$feedback."\n";
  $fromaddress="From:[email protected]";

  //invoke mail() function on send mail ?
   mail($toaddress, $subject, $mailcontent, $fromaddress);
?>

<html>
<head>
 <title>Bob's Auto Parts --Feedback Submitted<title>
</head>
 <h1>Feedback submitted</h1>
 <p>Your feedback has been sent.</p>
</body>
</html>

 

function.mail 18 Warning: mail() [ ]: Failed to connect to mailserver at "127.0.0.1" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\EasyPHP-5.3.5.0\www\test\processfeedback.php on line Call Stack

 

 

解决办法:

安装hmail:

PHP mail函数_第1张图片

 

查看数据库表:

PHP mail函数_第2张图片

 

 

PHP mail函数_第3张图片

 

PHP mail函数_第4张图片

 

PHP mail函数_第5张图片

 

PHP mail函数_第6张图片

 

配置esayphp.ini [我用的是esayphp]

[mail function]
;For Win32 only.
smtp=localhost
smtp_port=25

;For Win32 only.
[email protected]  

 

***********************

不报错了,可以发邮件了

 

 

你可能感兴趣的:(html,c,PHP,Web,UP)