是否可以在64位Win10中的localhost上使用PHP mail()
?
我使用xampp来运行localhost并试图使用这个函数,
但它返回错误Socket Error #10060<EOL>Connection timed out
我在32位Win上使用了这个配置,没有问题,
发送的邮件没有任何错误。
任何解决方案?
答案 0 :(得分:0)
a) Open the "php.ini". For XAMPP,it is located in C:\XAMPP\php\php.ini. Find out if you are using WAMP or LAMP server. Note : Make a backup of php.ini file
b) Search [mail function] in the php.ini file.
You can find like below.
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost
Change the localhost to the smtp server name of your ISP. No need to change the smtp_port. Leave it as 25. Change sendmail_from from postmaster@localhost to your domain email address which will be used as from address..
So for me, it will become like this.
[mail function]
; For Win32 only.
SMTP = smtp.example.com
smtp_port = 25
; For Win32 only.
sendmail_from = info@example.com
c) Restart the XAMPP or WAMP(apache server) so that changes will start working.
d) Now try to send the mail using the mail() function ,
mail("example@example.com","Success","Great, Localhost Mail works");
Mail will be sent to "example@example.com" from the localhost with Subject line "Success" and body "Great,Localhost Mail works"
答案 1 :(得分:0)
在Gmail帐户中发送邮件 - &gt;在sendmail(在wamp文件夹中)文件夹中打开文件“sendmail.ini”在记事本中进行编辑
更改此文件中的以下行 smtp_server = smtp.gmail.com //如果你使用gmail id