Maybe this is to blame GoDaddy?
They have a bad reputation.
Here’s what I found:
If you are running your code on Godaddy and trying to connect to some third-party SMTP provider like smtp.pepipost.com or smtp.sendgrid.com and getting some errors like this;
then nothing to really debug further, because it is because of a wried rule imposed by Godaddy on its user, where Godaddy has explicitly blocked the outgoing SMTP connection to ports 25, 587 and 465 to all external servers except for their own. Godaddy primarily wants their users to use their own SMTP instead of any third party SMTP, which is not at all an acceptable move for the developer community and many have has expressed their frustration in form of issues on StackOverflow too.
https://pepipost.com/tutorials/phpmailer-smtp-error-could-not-connect-to-smtp-host/
command
openssl s_client -connect smtp.gmail.com:587 -starttls smtp
return
CONNECTED(00000003)
depth=2 OU = GlobalSign Root CA - R2, O = GlobalSign, CN = GlobalSign
verify return:1
depth=1 C = US, O = Google Trust Services, CN = GTS CA 1O1
verify return:1
depth=0 C = US, ST = California, L = Mountain View, O = Google LLC, CN = smtp.gmail.com
verify return:1
---
Certificate chain
0 s:/C=US/ST=California/L=Mountain View/O=Google LLC/CN=smtp.gmail.com
i:/C=US/O=Google Trust Services/CN=GTS CA 1O1
1 s:/C=US/O=Google Trust Services/CN=GTS CA 1O1
i:/OU=GlobalSign Root CA - R2/O=GlobalSign/CN=GlobalSign
---
Server certificate
-----BEGIN CERTIFICATE-----
//l this delete.
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Mountain View/O=Google LLC/CN=smtp.gmail.com
issuer=/C=US/O=Google Trust Services/CN=GTS CA 1O1
---
No client certificate CA names sent
Peer signing digest: SHA256
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 3083 bytes and written 294 bytes
Verification: OK
---
New, TLSv1.2, Cipher is ECDHE-ECDSA-CHACHA20-POLY1305
Server public key is 256 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-ECDSA-CHACHA20-POLY1305
Session-ID: 9E8B34C9AE34E7E86C7AB2C46578E4D1D284386B8CC7CDF088461B7D652A88CE
Session-ID-ctx:
Master-Key:
//l this delete.
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 100800 (seconds)
TLS session ticket:
0000 - 01 30 b1 83 02 dc 9c 47-57 44 54 d4 4f 8f a2 cc .0.....GWDT.O...
0010 - 96 bc 9c e1 b9 19 e2 47-95 ae c2 a0 01 4f 4b 9e .......G.....OK.
0020 - 05 5f 17 89 64 48 2b 37-9e 2d 46 ea 21 26 6d 25 ._..dH+7.-F.!&m%
0030 - fe 9a 75 4d cd ba e1 73-a5 bf e6 dc c2 74 af 59 ..uM...s.....t.Y
0040 - dd 88 45 42 7a 4e b5 3e-36 25 6f 7a 76 c0 1e 70 ..EBzN.>6%ozv..p
0050 - 57 c3 7d 64 e1 48 c3 c2-eb 70 19 a4 3d 44 f7 0d W.}d.H...p..=D..
0060 - a8 2c 50 59 f4 e8 0c 9f-d3 55 ee 35 71 ea 85 87 .,PY.....U.5q...
0070 - 23 cb 9c ee 95 c6 fb 1a-cc 2e e4 68 e3 d4 4e ac #..........h..N.
0080 - 44 09 8f 00 db 4a 41 89-e4 83 56 f3 bb fc e3 35 D....JA...V....5
0090 - e9 f4 7e f6 c1 39 ca 19-cb f8 d0 5f 40 c0 1e 6a ..~..9....._@..j
00a0 - 7d 09 4b e5 e6 b9 eb 77-a2 b6 73 c2 df 52 03 1e }.K....w..s..R..
00b0 - f2 da b3 77 71 48 69 7b-da c1 a9 ae 32 60 65 94 ...wqHi{....2`e.
00c0 - e7 03 29 56 1c 19 db e1-25 0a 10 66 6c 51 f5 84 ..)V....%..flQ..
00d0 - 51 e5 b3 d6 40 97 52 b6-75 fe 1c cd c2 c6 e7 63 Q...@.R.u......c
00e0 - 39 05 9.
Start Time: 1598106345
Timeout : 7200 (sec)
Verify return code: 0 (ok)
Extended master secret: yes
---
250 SMTPUTF8