original title of this thread was: ssmtp - Cannot open smtp.gmail.com:587
it is solved for both gmail and openmailbox now, please see below.
_________________________________________________________________
I have a debian stable home server running.
apache & the website & cherrymusic are working just fine, but i cannot send any mail.
i need this for the contact page of my website, so that php can send mail, and the common solution seems to be to use sendmail, which seems to default to ssmtp on debian (at least the wiki tells me so).
I have been at this literally for months, on and off.
i also have a notion why it is not working: it was working previously, but then i've been messing around with dovecot and exim4, then purged the packages again but don't remember anymore all the files i changed.
also, while i was trying to set up ssl for my server, i made alterations to /etc/hosts and i don't remember anymore what the default should be.
yep, blame me for not making backup copies.
the current situation is such that i get the error message from the title when trying to send mail with /usr/sbin/ssmtp, both as root and as a normal user, both with firewall disabled or enabled.
this is an improvement, previously ssmtp would just hang for minutes, giving some timeout error in the end.
my current /etc/ssmtp/ssmtp.conf:
Code: Select all
root=someone@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=
hostname=
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES
AuthUser=someone@gmail.com
AuthPass=verysecret
AuthMethod=LOGIN
# this last line added after reading serverfault.com/a/560805
TLS_CA_Dir=/etc/ssl/certs
i tried telnet like here, and get the same response, it connects.
my normal user is in the mail group.
i also moved /etc/hosts* (host.conf hostname hosts hosts.allow hosts.deny) to a backup folder, and rebooted the system. surprisingly, it did not re-create /etc/hosts, but everything seems to be working fine (except ssmtp of course).
thanks for reading.
ANY help greatly appreciated.
i am at the end of my tether.
========================
other things i tried previously (as far as i remember):
- set up ssmtp exactly as outlined here (obviously, this didn't work. it does seem old & outdated)