我吧php.ini中的设置如下:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25; For Win32 only.
;sendmail_from = "[email protected]"; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
但是运行一下代码:
<?php
$to = "[email protected]";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: [email protected]" ;mail($to,$subject,$txt,$headers);
?>
之后,有错误提示如下:
Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\wamp\www\mail.php on line 12