Blocked Port 25: SMTP Using Postfix on Go Daddy Dedicated Server

How to use Godaddy's relay server for outgoing email on a Go Daddy dedicated server.

I've been setting up a new dedicated server at Go Daddy running Ubuntu 8.04 (Hardy Heron).  I was following The Perfect Server guide at HowToForge, and it was very helpful, especially in the area of setting up email using Postfix, which is new to me. I did run into an unexpected problem with outgoing email - it wasn't going out, or anywhere for that matter!  Taking a look in /var/log/mail.log showed an error saying "No route to host".  Trying to telnet to any other domain would give me the same error.  A little Googling dug up the fact that Godaddy blocks outgoing traffic on port 25, which is used for SMTP.  However they do provide a relay server that you can use for your outgoing mail. The relay server is k2smtpout.secureserver.net.  To use it, edit /etc/postfix/main.cf and set the relayhost line to look like this:
  1. relayhost = [k2smtpout.secureserver.net]
Then restart Postfix with the command:
  1. sudo /etc/init.d/postfix restart
And that should do it!  I had a lot of trouble diagnosing the problem and then finding the solution, so I thought I would post it here to help anyone else experiencing this problem.