Configuring an e-mail server for local testing on ubuntu is a really fast an easy task. You just need to install and configure sendmail with these commands:
1 2 sudo apt-get install sendmail sudo sendmailconfig
The first command gets and installs sendmail from ubuntu repositories. The second command will run a configuration script that will ask you some questions about your configuration.
After you do this you have to add a fully qualified domain name to your hosts file or your server will not work.
Your hosts file should have something like this:
1 127.0.0.1 yourdomain.dev
You can really write the domain name you want but it needs to be fully qualified, that means it should contain a top level domain, in my example dev.