ssmtp Cannot open mail.server.com:25

Solution 1:

Ok I figured it out... I had to use UseSTARTTLS=YES instead of UseTLS=YES. Also I had to enter root:[email protected]:mail.server.com:25in /etc/ssmtp/revaliases. Hope this helps others as well.

If you want to use other user accounts than root, you will have to add those to /etc/ssmtp/revaliases as well and add them to the 'mail' group.

Solution 2:

There is another case, which I encountered, where this happens: If you remove read access to ssmtp.conf from others because you don't want the password to be visible to all users, then you will get the same error unless your account has read access to that file. For example, when trying sendmail you might have to do sudo sendmail instead.