Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过本地主机发送邮件_Php_Email_Localhost - Fatal编程技术网

Php 通过本地主机发送邮件

Php 通过本地主机发送邮件,php,email,localhost,Php,Email,Localhost,我花了这么多时间,但未能通过localhost发送邮件。我读了很多博客,并按照他们的建议做了尝试,但我无法解决我的问题。那么我能做些什么来解决这个问题呢。 我还尝试了第三方,如sendmail、phpmailer等。。。。 我的php.ini文件配置为: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = smtp.gmail.com ; http://php.net/smtp-port smtp_port = 25 ;

我花了这么多时间,但未能通过localhost发送邮件。我读了很多博客,并按照他们的建议做了尝试,但我无法解决我的问题。那么我能做些什么来解决这个问题呢。 我还尝试了第三方,如sendmail、phpmailer等。。。。 我的php.ini文件配置为:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = ******224401@gmail.com

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

如果您有任何想法,我们将不胜感激……请提前取消这一行的注释

;sendmail_path ="C:\wamp\sendmail\sendmail.exe -t -i"
只要去掉分号就行了

sendmail_path ="C:\wamp\sendmail\sendmail.exe -t -i"

然后重新启动apache

您是否连接到本地主机上的邮件服务器?我认为您无法让它工作。Sendmail已过时。尝试使用SwiftMailer@Jack查看Stackoverflow上的这篇帖子——如果它不起作用,你能用你用来发送邮件的php代码更新这个问题吗?