如何发送电子邮件使用谷歌SMTP服务器使用XAMPP


How To Send Emails Using Google SMTP Server Using XAMPP?

在php.ini中我设置:

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

In my sendmail.ini:

smtp_server=smtp.gmail.com
smtp_ssl=ssl
auth_username=mygmail@gmail.com
auth_password=mygmail password

在我的错误日志:

13/05/18 23:33:30 : Socket Error # 10060<EOL>Connection timed out.

这封邮件实际上发送了两次,但99%的情况下,我得到的错误与上面相同。我关闭了路由器的SPI和电脑的防火墙。什么好主意吗?

大多数装有Windows的本地盒子没有SMTP服务器。您可以使用外部SMTP服务器并在php.ini文件中配置它,但是SMTP身份验证是不可能的。

我建议你使用PHPMailer,这是一个简单而灵活的PHP类,它可以使用SMTP服务器进行身份验证。它也比使用捆绑的PHP mail()函数更安全。

http://phpmailer.worxware.com/