I have been playing around with setting up a home server and one thing I learned is that my current ISP does not allow an SMTP server to send out mail. This meant that any of the random web applications or server software I installed was unable to to generate and send an email that would actually be received to an email account in the outside world.
I imagine that my ISP does this to cut down on the amount of SPAM that is generated from their network (through virus infected computers and such). Thankfully my ISP also offered a SMTP server that I could forward mail through, however it requires authentication.
I am using an Ubuntu server and it runs Postfix as the default MTA, so I figured I would just use it to forward the mail from my home server, through my ISP's server and then out to the world.
Here is what I had to do to get it working.
First I opened up the main.cf file for Postfix.
sudo vim /etc/postfix/main.cf
Add these lines to the file. The 'relayhost' line might already be in the file. Set that line equal to the server you intend to relay through. I saw some examples that didn't include the brackets ('[]'), but mine wouldn't work without them.
relayhost = [smtp.my.isp.com]
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options =
After you save that file, create a directory to store your password files in.
sudo mkdir /etc/postfix/sasl
Next you need to create your password file.
sudo vim /etc/postfix/sasl/sasl_passwd
Inside that file you need to add one line that defines the username and password for the smtp server you want to relay through.
smtp.my.isp.com username:password
Once you create the password file, you need to create a hash of it.
postmap /etc/postfix/sasl/sasl_passwd
This should create a file called sasl_passwd.db in the same directory. At this point you can either change the permissions on the file 'sasl_passwd' to protect your login information or I think you can just get rid of it.
After that all you have to do is restart the daemon.
sudo /etc/init.d/postfix restart
Now your server should be able to send mail out the the real world by relaying it through the other server.
This article below helped me greatly in figuring out how this is done.
http://ben.franske.com/blogs/bensbits.php/2005/09/06/postfix_smtp_auth_support_for_relayhost