如何使用gmail SMTP从IIS PHP发送电子邮件?

How can I use IIS6 PHP with gmail smtp. I am running windows 7.

My php.ini file has on the bottom

SMTP = smtp.gmail.com
smtp_port = 25
auth_username = [username]
auth_password = [password]
sendmail_from = [username]@gmail.com

When I try it in php, I get the error:


Warning: mail(): Failed to connect to mailserver at "smtp.gmail.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Users\Me\Desktop\App\App\script\config\common.php on line 60

Right now, the server is on my home wifi network (router, modem). However if I connect my server to my LTE phone data plan, then it works fine.

Does anyone know what the problem is? Maybe a firewall thing?

Thanks

In this particular circumstance, I suspect your LTE provider is firewalling port 25.

Gmail does have some alternative ways to send mail that might work. Take a look here and see if any of these scenarios will meet your needs. https://support.google.com/a/answer/176600?hl=en