Wednesday, March 7, 2007

ssmtp on freebsd

I've been using FreeBSD off and on since version 3.x was considered leading edge. I never cared much for keeping close tabs on the logs and overall operation.....I'd update when I had the chance, have a look at the logs, see what's been happening. I found sendmail filling my logs to be quite annoying - I didn't want to be emailed cron output. So, I disabled sendmail in rc.conf.

However, I have little spare time and so having an email in my inbox each morning with a summary would now be useful. So I re-enabled sendmail, but as it turns out, as is with many ISPs nowadays, outgoing connections to port 25 are disallowed - so having my server send the email directly (to my gmail account) wasn't gonna happen. So, looks like the default sendmail configuration wasn't going to work. A bit of googling told me that sendmail configuration was gonna be rough. So....I looked for an alternative. Enter ssmtp.

ssmtp is a simple MTA sendmail replacement that I found while looking at the FreeBSD handbook. It provides simple configuration for sending outgoing mail only - which is all I want to do. This gentoo how-to was also quite helpful (as many gentoo postings are).

I made copy of the sample ssmtp.conf file in /usr/local/etc/ssmtp/ and added the following:

root=email_addr_to_send_root_emails_to
mailhub=isp_smtp_server
rewriteDomain=domain_emails_should_appear_from
hostname=computer_hostname
AuthUser=isp_email_login_id
AuthPass=isp_email_password


As I said, my ISP won't allow connections to port 25, so I have to use their smtp server, thus the need to provide authentication credentials.

Test with:

echo "testing mail service from my host" | mail root

And a few minutes later I see an email from my host.

No comments: