I am currently trying to configure a PHP application for sending emails but I noticed the following lines in the php-error.log file [12-Feb-2024 16:56:29 UTC] Connection: opening to ssl://smtp.gmail.com:587, timeout=300, options=array() [12-Feb-2024 16:58:38 UTC] Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:587 (Network is unreachable) [/var/www/8a152391-1500-44f6-8b96-83b99c8204a6/public_html/lib/pkp/lib/vendor/phpmailer/phpmailer/src/SMTP.php line 375] [12-Feb-2024 16:58:38 UTC] SMTP ERROR: Failed to connect to server: Network is unreachable (101) [12-Feb-2024 16:58:38 UTC] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting [12-Feb-2024 16:58:38 UTC] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
So I was wondering if there is any additional configuration that I need to make
Check that your server provider allows port 587 outbound.
Also check that ufw hasn't been disabled on your web server. Run ufw enable as root. ufw manages the NAT rules for the PHP containers so must be enabled.
ufw enable