How to setup gmail to be used with mautic

Your software
My Mautic version is: 5.04
My PHP version is: 8.1
My Database type and version is: mariadb

Your problem
My problem is: i can’t setup gmail in mautic

These errors are showing in the log: Connection could not be established with host “smtp.google.com:587”: stream_socket_client(): Unable to connect to smtp.google.com:587 (Connection timed out)

Steps I have tried to fix the problem:

(smtp://email@gmail.com:SECRET@smtp.google.com:587)

i have set an app password in google account and put it in Email DSN settings;
i’ve also tried with regular password but the same happens;

any idea? for what i’ve searched here it is supose to be straight forward…

Port 587 seems to cause issues with php mailers.

I have an instance running with Gmail as mailer. I documented the set-up:

Thank you!