Q:

ssmtp: Cannot open smtp.gmail.com:587

I try to send a email using ssmtp but it not working
My ssmtp config file
root=test@gmail.com
mailhub=smtp.gmail.com:587
AuthUser=test@gmail.com
AuthPass=*****
UseTLS=YES
UseSTARTCTLS=YES
rewriteDomain=gmail.com
hostname=localhost
FromLineOverride=YES
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt

revaliases
root:test@gmail.com:smtp.gmail.com:587

I am using Ubuntu 14.04. 

A:

There are a few small typos in your config. You have written:
UseSTARTCTLS=YES
        ^

(I have marked the error) where you should have written:
UseSTARTTLS=YES

And finally the path for the certificates in Trusty should be written not as this:
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt

but more correctly as:
TLS_CA_File=/etc/ssl/certs/ca-certificates.crt

These corrections should be enough to get you going :)
References:

Arch Wiki: SSMTP

