Assuming you already have a main mail server in your organization that you can use as a "smarthost" relay, run through these simple steps and you will be up and running with a local SMTP server on your Ubuntu GNU/Linux box in no time.
1.) Install the MTA package on your Ubuntu 12.04 GNU/Linux box:
sudo apt-get install exim4-daemon-light
2.) Configure the MTA with this command and steps, replacing somedomain.com with your mail domain name:
sudo dpkg-reconfigure exim4-config
- Set postmaster email: email@example.com
- Select 'mail sent by smarthost; no local mail'
- Set somedomain.com at the "System mail name" screen
- Set defaults(hit enter) until you get to the step below
- Enter mail.somedomain.com for the "IP address or host name of the outgoing smarthost:"
- Set defaults all the way to the finish
That's it! exim4 should restart and you'll be ready to test. Now wasn't that easy?
Now check if the smtp server is listening on port 25 (smtp) with these terminal commands:
netstat -ano |grep :25
Should see something like:
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN off (0.00/0/0)
Test the setup by sending an email to yourself from the Terminal:
echo "Yay - SMTP works" | mail -s "Test email" firstname.lastname@example.org
That's it! Now you're free to go and get the beverage of your choice and drink to the awesomeness of the makers of FOSS/GNU/Linux/Ubuntu.