How To Send Emails Using Google SMTP Server Using

2020-05-01 06:57发布

问题:

In php.ini I set:

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

In my error log:

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

The email actually sent twice, but 99% of the time, I get the same error as above. I disabled my router's SPI, and my computer's firewall. Any ideas?

回答1:

Most local boxes with Windows don't come with a SMTP server. You could use an external SMTP server and configure it in your php.ini file, but SMTP authentication is not possible.

I recommend you to use PHPMailer, is a simple and flexible PHP Class, that can use a SMTP server with authentication. It is also more secure than using bundled PHP mail() function.

http://phpmailer.worxware.com/



标签: php email smtp