3

Thank you in advance,

I have deployed my Laravel application into Google Cloud Compute Engine, I used my own Gmail SMTP to send email from the Laravel, it is working well in my local system and over AWS too. but not in Google Compute Engine, I checked it is not showing any error but I am unable to receive any emails from the system

My SMTP setting is as below in .env

MAIL_MAILER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME={USERNAME}
MAIL_PASSWORD={PASSWORD}
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS={FROM_EMAIL}
MAIL_FROM_NAME="${APP_NAME}"
Ronak Solanki
  • 341
  • 2
  • 5
  • 14
  • GCE does block ingress/egress for tcp:25 in all VMs unconditionally (https://cloud.google.com/vpc/docs/firewalls#blockedtraffic), but not tcp:465. I could reach this server through that port from a GCE VM without any egress VPC firewall rules with `curl -v smtps://smtp.googlemail.com:465` (returning `< 250-smtp.googlemail.com at your service`). If you get the same result it might be some other issue with the PHP application that would require debugging with eg. Laravel Debugbar (https://github.com/barryvdh/laravel-debugbar). Otherwise, check on the VPC firewall rules for your GCE VM. – Arnau C. Dec 19 '20 at 13:30
  • Hi, thank you so much for your answer, can you please help me out, should I change something in the firewall or in SMTP settings in the .env file? also, I tried curl -v smtps://smtp.googlemail.com:465 and it is responding successfully – Ronak Solanki Dec 21 '20 at 07:44
  • Since there is communication between the VM and the SMTP server, I don't think this is an issue with the VPC network or GCE. It could be the server determining to reject the request for any other reason (eg. the external IP address that your VM was given), and to really know what's happening you will probably need the SMTP server's response to the application's requests, which you might be able to find in Laravel's debug output as I mentioned, though I'm not experienced with Laravel. Otherwise, perhaps the answers in this similar thread may help: https://stackoverflow.com/questions/23980979 – Arnau C. Dec 22 '20 at 14:58

0 Answers0