Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I am trying to get my hands on a good command line email tool for Ubuntu so that I can send simple emails may be even attach files through the terminal or simple bash scripts. My ssmtp.conf file looks something like this right now:

# Config file for sSMTP sendmail
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named

# Where will the mail seem to come from?

# The full hostname
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address

I also added alias in the revaliases file as follows:

I am behind a proxy server which works when i set an automatic proxy configuration URL and my system proxy settings are set according to the automatic proxy configuration URL.

However when I run sSMTP from terminal using:

sudo ssmtp
hello world 

Then pressing ctrl+d, I get:

ssmtp: Cannot open

The title is the question.

share|improve this question

2 Answers 2

The port is wrong. Your aliases need updating too.

Gmail only really allows SSL emails from remote hosts, other connections usually don't work. Enable SSL and use port 465.

If that doesn't work verify connectivity with telnet:

telnet it should work, and return gibberish.

share|improve this answer
Thanks for your reply @coteyr, I changed the port to 465 but get this error Cannot open and I tried telnet it says network unreachable . So i think it is a connectivity issue. Am i missing some certificates that need to be installed or is the proxy? how do i resolve it? –  Vivek Pradhan Jan 22 '13 at 18:11
it is possible that your network configuration does not allow any traffic that does not go though the proxy. I have seen a few setups like that. Network Unreachable means that it can't get to at all, and has nothing to do with SMTP or proxy. Check your default route, and try tracert You may need to install it. –  coteyr Jan 22 '13 at 18:32

I've tested the upper combination and the port is correct. Definitely, 587 is a correct port, I selected this value for my settings and work.

Probably the problem here is due to the existence of an outgoing rule into the firewall, or a new limitation of the security policy of gmail. You have to go to and check "Access for less secure apps": it must allowed, it's disallowed by default.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.