PHP-使用xampp localhost发送邮件

PHP-使用xampp localhost发送邮件,php,email,xampp,Php,Email,Xampp,我正在尝试使用xampp发送到gmail 我的PHP版本是5.6.8 以此为指导,, 我更改了php.ini和sendmail.ini的配置,但它对我不起作用。 页面始终显示失败:未发送电子邮件 这是我的php: $to = 'kennybanny12@gmail.com'; $subject = 'No subject'; $message = 'Hello, this is the content of the email.'; $headers = 'From: sticolle

我正在尝试使用xampp发送到gmail

我的PHP版本是5.6.8

以此为指导,, 我更改了php.ini和sendmail.ini的配置,但它对我不起作用。 页面始终显示失败:未发送电子邮件

这是我的php:

$to      = 'kennybanny12@gmail.com';
$subject = 'No subject';
$message = 'Hello, this is the content of the email.';
$headers = 'From: sticollegesocial@gmail.com';

if(mail($to, $subject, $message, $headers)) {
    echo 'Email sent successfully!';
} else {
    die('Failure: Email was not sent!');
}
这些是我在php.ini:

SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = sticollegesocial@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=sticollegesocial@gmail.com
auth_password=**********
force_sender=sticollegesocial@gmail.com
sendmail.ini:

SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = sticollegesocial@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=sticollegesocial@gmail.com
auth_password=**********
force_sender=sticollegesocial@gmail.com

看起来你做得很好,但那篇文章没有作者的名字。这可能会对您有所帮助。

您放置的URL是什么??错误404@Rajeshoh抱歉我的错误。。单击此处获取正确版本您的本地主机中是否有SMTP服务器?您下载了吗??