Is a bug of all smf version at now. The SMTP server is ssl://mail.gmail.com but when send HELO command the smf says: HELO ssl://mail.gmail.com and the gmail server return a error by malformed HELO.
When says HELO localhost your server fall in black lists, the HELO server canot say localhost.
The solution for me is replace
if (server_parse('EHLO ' . $modSettings['smtp_host'], $socket, null) == '250')
By
if (server_parse('EHLO ' . str_replace('ssl://'.$modSettings['smtp_host']), $socket, null) == '250')
In all lines when use $modSettings['smtp_host'] except to connect in socket.
The smf need a checkbox with "enable ssl" and put the prepend schema ssl:// and check if the input of server name is a real host and not the schema.