You can not send emails using php in a google cloud instance

0

More specific: I'm using a centos installation 7, I use php 5.6 and I'm trying to send emails using some joomla components, specifically chrono forms 5, because no error is reported when sending a form from a website , but also the emails do not arrive, I did a test using a simple email code:

    <?php
if (@mail("[email protected]", "Probando email en php", "Esto es una prueba a ver si funciona el mail en php")) {
echo('<p>Email enviado.</p>');
} else {
echo('<p>Email NO ENVIADO.</p>');
}
?>

This code does not send any mail, but it does not generate any errors either.

I have read somewhere that from Google Cloud, it is necessary to use a third-party service to send emails, but the truth is that I do not find anything useful or at least understandable in order to make the server send an email.

I have tried on another server (hostgator) with configurations similar to Google Cloud, and it works correctly there.

Please help, this is important, because a site that is not able to send forms to its visitors, is a site that is not 100%.

    
asked by Carlos Cotton 26.10.2017 в 20:42
source

2 answers

0

Ola, well I tell you that I have a similar problem and what I have found is that Google Cloud blocks the output port SMTP (port 25) by security issues and it is impossible to unlock it, I am trying to see how it is done to redirect the email output through another port

    
answered by 19.12.2017 в 16:46
0

Google cloud does not allow sending by port 25, you can use some api like mandrill or sendgrid to achieve it without any problem.

This security measure is taken by many datacenters since sending emails is considered abusive and many people take advantage to spam.

    
answered by 22.12.2017 в 04:50