在xampp中配置smtp服务

在xampp中配置smtp服务,xampp,smtp,localhost,Xampp,Smtp,Localhost,我正在尝试从本地主机发送邮件。我正在使用xampp,但每次我都会收到相同的错误,说“找不到主机”,请帮助 这是我的php.ini文件 ; For Win32 only. ; http://php.net/smtp SMTP=smtp.gmail.com ; http://php.net/smtp-port smtp_port=587 ; For Win32 only. http://php.net/sendmail-from sendmail_from = bajajsb08@gmail.com

我正在尝试从本地主机发送邮件。我正在使用xampp,但每次我都会收到相同的错误,说“找不到主机”,请帮助

这是我的php.ini文件

; For Win32 only.
; http://php.net/smtp
SMTP=smtp.gmail.com
; http://php.net/smtp-port
smtp_port=587
; For Win32 only.
http://php.net/sendmail-from
sendmail_from = bajajsb08@gmail.com

; For Unix only.  You may supply arguments as well (default: "sendmail -
t").
; http://php.net/sendmail-path
sendmail_path ="\"L:\xampp\sendmail\sendmail.exe\" -t"

; 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().
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed 
by the filename
mail.add_x_header=off
这是我的sendmail.ini

[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
error_logfile=error.log
debug_logfile=debug.log
auth_username=bajajsb08@gmail.com
auth_password=******
force_sender=bajajsb@gmail.com
hostname=smtp.gmail.com
这里是debug.log

17/06/23 11:25:06 ** --- MESSAGE BEGIN ---
17/06/23 11:25:06 ** To: bajajsb08@gmail.com
17/06/23 11:25:06 ** Subject: Test email
17/06/23 11:25:06 ** From: bajajsb@gmail.com
17/06/23 11:25:06 ** Reply-To: bajajsb@gmail.com
17/06/23 11:25:06 ** 
17/06/23 11:25:06 ** Hello World!
17/06/23 11:25:06 ** 
17/06/23 11:25:06 ** This is my first mail.
17/06/23 11:25:06 ** --- MESSAGE END ---
17/06/23 11:25:07 ** Connecting to smtp.gmail.com:587
17/06/23 11:25:07 ** Disconnected.
17/06/23 11:25:07 ** Disconnected.
17/06/23 11:25:07 ** Disconnected.
17/06/23 11:25:07 ** Socket Error # 11001<EOL>Host not found.
17/06/23 11:25:06**---消息开始---
17/06/23 11:25:06**至:bajajsb08@gmail.com
17/06/23 11:25:06**主题:测试电子邮件
17/06/23 11:25:06**发件人:bajajsb@gmail.com
17/06/23 11:25:06**回复:bajajsb@gmail.com
17/06/23 11:25:06 ** 
17/06/23 11:25:06**你好,世界!
17/06/23 11:25:06 ** 
17/06/23 11:25:06**这是我的第一封邮件。
17/06/23 11:25:06**---消息结束---
17/06/23 11:25:07**连接到smtp.gmail.com:587
17/06/23 11:25:07**已断开连接。
17/06/23 11:25:07**已断开连接。
17/06/23 11:25:07**已断开连接。
17/06/23 11:25:07**套接字错误#11001找不到主机。
下面是我正在运行的基本邮件脚本:

<?php 
$to = 'bajajsb08@gmail.com';
$subject = 'Test email'; 
$message = "Hello World!\n\nThis is my first mail."; 
$headers = "From: bajajsb@gmail.com\r\nReply-To: bajajsb@gmail.com";
$mail_sent = @mail( $to, $subject, $message, $headers );
echo $mail_sent ? "Mail sent" : "Mail failed";
?>

您将在这里找到您的答案


您将在此处找到答案

我已经尝试过,但无法排序此主机未找到错误:(我已经尝试过,但无法排序此主机未找到错误:(如果您有防火墙,可以阻止apache的internet连接。但请确保检查过没有问题。请有人帮助我,我的项目因此而暂停:(如果您有防火墙可以阻止apache的internet连接。但请确保检查后没有问题。请有人帮帮我,我的项目因为以下原因暂停:(