A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Victory Over Email Services!

I am happy to report that after quite a lot of time trying various email solutions, I have FINALLY been able to get email services (in this case “out-bound only” email capability) running on my linux solid state server that I wrote about a while back (click here for the original post). You would think that this would be a rather simple thing to accomplish…but due to the current state of older software and spam protection mechanisms, it turns out to be more involved than you might think.

This story begins back when I began running automated scripts each night on my server. One thing I wanted to do was have my nightly scripts, which do things like back up data to a NAS device (network attached storage), email me if there are any problems encountered. Obviously, I don’t want to have a system crash and THEN discover that my nightly backups have not been “backing up” for the last year!

Well, in the scripting world on Linux (sorry this is going to get a bit technical), a program called “sendmail” is the old workhorse for whenever you need to send an email from a program or script. Sendmail was my first attempt at setting up out-bound email…and it gave me nothing but headaches.

Sendmail is not the most simple piece of software to configure. However, it has been around for a long time, so I had the benefit of other people’s experience (by looking up the escapades of other people like myself on the web). It turns out that one of the “protections” that my internet service provider has in place to prevent people from sending massive amounts of spam email from their homes is that they block outbound traffic on TCP port 25.  Note that when you connect to a standard email server to send mail (an SMTP server), you usually connect on port 25. With this outbound port blocked by my ISP, I had to use a different port.

Sidenote: I had decided to use the email server of my web hosting company (which happens to be Hostgator…a company I have been with for years and can highly recommend) rather than my ISP’s email server because of problems I have had with my ISP’s mail server in the past.

It turns out that my web hosting company also provides a mail server connection on port 26, so all I had to do was get sendmail to send to port 26 rather than port 25 and all would be set. After many hours of research, I came to the conclusion that sendmail, being as old as it is, HAS NO WAY TO CONNECT TO A PORT OTHER THAN TCP PORT 25! Thus, I had to scrap my plans to use the sendmail package.

Next up was a full featured mail server called Exim. I installed Exim, and while I knew it was gross overkill to use a full email server for my sparse needs, I had heard that Exim was a solid piece of software and well documented. I thought that for sure Exim would be able to solve myproblem…even if it WAS overkill.

As it turned out, after many hours of tinkering with Exim…I gave up on it. Could it solve my problem? Most definitely! Was it well documented? I’d have to say “yes.” Was it royally over-the-top overkill? You betcha!

The problem with Exim *is* the fact that it is so full featured. It has so many gizmos and such to handle the most demanding of emailing needs that it requires a significant investment in time just to learn how to set it up. Now keep in mind, computers are not new to me. I hold both a bachelors and a masters degree in computer science and I have dealt with email servers before…but nothing on this level of completeness/complexity. I decided that I would have to study for weeks (maybe an exaggeration) before I would know enough to properly configure that beast…so I gave it up as a bad idea as well.

Then I found the most wonderful piece of software for my needs that I could possibly stumble upon. I came across a software package called ssmtp. It was written by folks that were trying to solve exactly the same problem that I was working on. They just wanted to send out-bound email from scripts running on a server. This package, which is available directly from the package management system on Ubuntu Linux (and probably all other distributions of Linux) installs in seconds. You configure it by setting some obvious fields in its rather small config file (like “address of outbound mail server/smarthost”, user name for the outbound mail server, password for the outbound mail server, etc.) and you are off and running!

I had the mail services up and running within 10 minutes once I started working with ssmtp!

I would like to point out that I found a really good write-up online regarding how to configure ssmtp. You can find that writeup by clicking here.

So now I have the ability to send emails via my solid state server. So what else can I do with this? Well, my next trick will be to download weather information from the National Weather Service and put together a short “summary” to email to my cell phone. I don’t own a “smart phone,” but with just a little bit of coding, I intend to turn my “Plain Jane” cell phone into a “smarter” phone by having weather reports sent to it at key times during the day.

Yes, I know, there are probably existing ways of doing this already, but it is good practice for the geek in me! I’ll let you know how that goes as well…when I get around to it.

Until that time…live well!

Comments are closed.