google smtp 在部署时不工作,但在本地服务器上工作

google smtp is not working on deployment but it works on local server

google smtp 在本地服务器上工作正常,但在部署后它给了我错误

exception: "Swift_TransportException" file: "/home/sellective/public_html/sellective/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php" line: 269 message: "Connection could not be established with host smtp.googlemail.com"

我的凭据是正确的。 我尝试了另一个帐户,另一个端口和另一种加密方法也不起作用。

几天前我遇到了类似的问题。但我使用 PHPMailer 获取 gmail SMTP 服务器连接。也许,您的服务器属于 goDaddy 域。 PHPMailer wiki 是这样说的:

Popular US hosting provider GoDaddy imposes very strict (to the point of becoming almost useless) constraints on sending an email. They block outbound SMTP to ports 25, 465 and 587 to all servers except their own.

因此,您可能无法从当前服务器使用 google SMTP。

使用 WhoIs 服务检查谁是您的主机的注册商。

goDaddy 阻止来自其他主机的 smtp 服务。只有它自己的服务有效,所以我用了 "relay-hosting.secureserver.com" 作为邮件主机和邮件端口“25”,不加密。 goDaddy 为您加密。