Gravity Forms对接Office365 SMTP失败求助:连接超时(SMTP代码110)
Gravity Forms对接Office365 SMTP连接超时问题解决
问题概述
将Gravity Forms对接SMTP服务时出现连接超时错误,使用的是Office365的SMTP服务器(smtp.office365.com:465),域名和邮箱托管在GoDaddy且已启用认证。错误详情:
Mailer: Other SMTP SMTP Error: Could not connect to SMTP host. Failed to connect to serverSMTP server error: Failed to connect to server SMTP code: 110 Additional SMTP info: Connection timed out Debug Output: Connection: opening to ssl://smtp.office365.com:465, timeout=300, options=array() Connection failed. Error #2: stream_socket_client(): Unable to connect to ssl://smtp.office365.com:465 (Connection timed out) [/home/xdawfds/public_html/xdaw7285h5-staging.wpdns.site/xdaw7285h5-staging.wpdns.site/xdaw7285h5-staging.wpdns.site/wp-includes/PHPMailer/SMTP.php line 397] SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP Error: Could not connect to SMTP host. Failed to connect to server
解决步骤
1. 修正Office365 SMTP配置参数
Office365官方优先推荐587端口配合STARTTLS加密,而非465端口,调整配置如下:
- SMTP服务器:
smtp.office365.com - 端口:
587 - 加密方式:
STARTTLS - 认证:开启
- 用户名:完整的Office365邮箱地址(如
xxx@yourdomain.com)
2. 处理多因素认证(MFA)
若Office365账户开启了MFA,禁止使用普通登录密码,需在Office365账户设置中生成「应用密码」,用该密码替换SMTP配置里的登录密码。
3. 检查GoDaddy服务器端口限制
GoDaddy共享主机可能限制出站SMTP端口,通过服务器SSH执行以下命令测试连通性:
telnet smtp.office365.com 587
或
curl -v smtp://smtp.office365.com:587
若无法连通,联系GoDaddy客服申请开放对应端口,或改用GoDaddy自带SMTP服务:
- SMTP服务器:
smtpout.secureserver.net - 端口:
465(SSL)或587(TLS) - 用户名:你的GoDaddy邮箱地址
- 密码:邮箱登录密码
4. 验证账户权限
登录Office365网页端测试发送邮件,确认邮箱账户未被限制发送权限,账户状态正常。
5. 排查PHPMailer设置
在Gravity Forms的SMTP配置中:
- 确认用户名是完整邮箱地址,无拼写错误
- 密码(或应用密码)输入正确
- 超时时间保持默认300秒即可
内容的提问来源于stack exchange,提问作者Faaz Muhammed
相关产品推荐
相关产品推荐

