I know that's a lot of topics about this, but I cant find one that solve my problem, I really search, but cant find a solution, if you can help me I will be very glad:
I'm trying to use SMTP on my website, but fail everytime I try to send a email.
The error -> Warning: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) in /home/vhosts/www.mysite.com/system/library/mail.php on line 167
I'm using cloudflare on my website, to https.
Cludflare setup with gmail MX records, and CNAME with name = "mail" and value = ghs.google.com (Gray option active)
I'm using gmail (using godady to .com, and configured on gmail on port 465 SSL as a aliass).
Gmail less secure apps disabled (also tried enabled)
Gmail two steps verification disabled (also tried enabled, and also tried use app password of the gmail on opencart SMTP Password )
Contacted the host, ports 25, 465, 587 are open, and I can use SMTP.
I'm using the following setup on opencart
Mail Protocol: SMTP
Mail Parameter: -fmysite@mail.com (also tried blank)
SMTP Hostname: ssl://smtp.gmail.com (also tried: smtp.gmail.com , tls://smtp.gmail.com )
SMTP Username: mysite@mail.com
SMTP Password: My Gmail password
SMTP port: 465 (also tried: 25, 587)
Timeout: 5 (also tried: 7, 60, 200)
Already tried with outlook, zohoo, but the same problem.
I dont want to use Mail Protocol: MAIL, because this way, all emails go to SPAM folder.
Using the port 25 I get the error -> fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol in /home/vhosts/www.mysite.com/system/library/mail.php on line 167Warning: fsockopen(): Failed to enable crypto in /home/vhosts/www.mysite.com/system/library/mail.php on line 167Warning: fsockopen():
My opencart version 2.3.0.2
Please Help Me

PS english is not my native language, sorry.