我目前正在使用xampp 1.7.0
,我的 php 版本是5.2.8
我将php.ini
文件更改为:
[mail function]
; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 465
我的 send_email.php 文件看起来像:
$to = "myemail@gmail.com";
$subject = "Test mail";
$message = "Hello! This is a test message.";
$from = "someonelse@gmail.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
但是,它显示以下消息:
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:\xampp\htdocs\NFL\send_email.php on line 15
第 15 行是:
mail($to,$subject,$message,$headers);
我该如何解决这个问题?
注意:我还在邮件调用中添加了第 5 个参数来强制系统使用发件人电子邮件地址,但没有奏效!