PHP Mailer Function在Google Cloud Platform上不起作用

问题描述:

最近我已经在 Google Cloud Platform 上上传了一个小型php网站,但是在上传网站后,我看到 PHP Mailer 功能不会发送邮件.

Recently i have uploaded a small php web on Google Cloud Platform, but after uploading site i see that PHP Mailer function does not send mail.

使用相同的SMTP凭据,可以完美地运行localhost中的相同代码.

The same code in the localhost runs perfectly, with same SMTP credentials.

是否需要更改我的代码?

Is there need to change my code?

请,任何人都可以帮助我解决此问题.

Please, any one helps me out to resolve this issue.

Google Compute Engine不允许端口25、465和587上的出站连接.默认情况下,由于大量滥用,这些出站SMTP端口被阻止了这些端口容易受到攻击.此外,拥有可信赖的第三方提供商(例如SendGrid,Mailgun或Mailjet)可减轻Compute Engine的负担,使您免于在接收方保持IP信誉.

Google Compute Engine does not allow outbound connections on ports 25, 465, and 587. By default, these outbound SMTP ports are blocked because of the large amount of abuse these ports are susceptible to. In addition, having a trusted third-party provider such as SendGrid, Mailgun, or Mailjet relieves Compute Engine and you from maintaining IP reputation with your receivers.

您可以在VPS服务器上安装后缀,并将其配置为通过MailGun或其他服务发送邮件.

You can install postfix on your VPS server and configure it to send mails by MailGun or other service.

有关此问题的更多信息,您可以在官方文档中找到: https://cloud.google.com/compute/docs/tutorials/sending -mail/

More information about this problem you can find in official documentation: https://cloud.google.com/compute/docs/tutorials/sending-mail/