Thanks for the reply.
We telnetted to the GMAIL server and port 587 from the server where the OSTicket is installed, and we can connect without problems, the connection is maintained. But when we use port 587 to configure the mail on the OSTicket, it gives the same error message.
When we telnet from port 465 it connects and, after aprox 20 seconds, it disconnects. The server is open for all destinations all ports in the Firewall.
I am attaching the image of the test we did.
Do you have any idea what could be happening?