我已经在
windows 8上安装了wamp.
有错误:
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\mail.PHP on line 9
这里是简单的源代码:
<?PHP // The message $message = "Line 1\r\nLine 2\r\nLine 3"; // In case any of our lines are larger than 70 characters,we should use wordwrap() $message = wordwrap($message,70,"\r\n"); // Send mail('caffeinated@example.com','My Subject',$message); ?>
尝试这个
原文链接:https://www.f2er.com/windows/364070.html配置此设置
在PHP.ini
SMTP=smtp.gmail.com smtp_port=587 sendmail_from = my-gmail-id@gmail.com sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
在sendmail.ini中:
smtp_server=smtp.gmail.com smtp_port=587 error_logfile=error.log debug_logfile=debug.log auth_username=my-gmail-id@gmail.com auth_password=my-gmail-password force_sender=my-gmail-id@gmail.com
Important: comment following line if there is another
sendmail_path
in thePHP.ini
:sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
Note: Tested and works fine in my Windows 8.1