简体   繁体   中英

How to send email from IIS PHP using gmail SMTP?

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:


: 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 on line :mail():无法连接到“smtp.gmail.com”端口25的邮件服务器,验证php.ini中的“SMTP”和“smtp_port”设置或使用 ini_set()第行的

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM