Gmail with sSMTP on Deb-based system
Before I made the switch to
Google Apps, I had my own mail server but I never had time to made to
switch to something more easyer like sSMTP to replace the mail server.
sSMTP is :
A secure, effective and simple way of getting mail off a system to yourmail hub. It contains no suid-binaries or other dangerous things - no mailspool to poke around in, and no daemons running in the background. Mail issimply forwarded to the configured mailhost. Extremely easy configuration.
In three easy steps I got it running:
Installation:
Step 1: apt-get install ssmtp
Configure 2 files:
Step 2: In /etc/ssmtp/ssmtp.conf, set the following:
root=youraccount@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=
hostname=youraccount@gmail.com
UseSTARTTLS=YES
AuthUser=youraccount
AuthPass=yourpasword
FromLineOverride=YES
Step 3: In /etc/ssmtp/revaliases:
root:youraccount@gmail.com:smtp.gmail.com:587
mainuser:youraccount@gmail.com:smtp.gmail.com:587
Done!!!
For more information on sSMTP:
I have tried this over and over again and all I get is “ssmtp: Cannot open mailhub:25″
xlq:
could you list your config file please?
I used exactly the same config file as in the article, except with my own e-mail address and password.
xlq:
Yes, I see it:
send-mail: Cannot open mailhub:25
Can’t send mail: sendmail process failed with error code 1
That would happen if you set the config file to permissions that did not allow ssmtp to read it.
In my case, it’s fine if the file is world-readable, but of course I can’t leave it that way since it has my gmail password written right there. When I chmod 600 the config file, ssmtp can’t read it and I get the silly mailhub error you saw. Interesting!
tai
found your site on del.icio.us today and really liked it.. i bookmarked it and will be back to check it out some more later ..
I ran into the same problem when securing ssmtp. The best resource I’ve found on this subject so far is http://wiki.freebsd.org/SecureSSMTP
That page is specific to BSD but I think the general idea applies to Linux as well, since they’re both UNIX.