I don't know why but this is one of those things that I find extremely annoying to set up. Mainly because it often requires installing a full-blown MTA to do a much simpler job than it was designed to do. Unfortunately, ssmtp and exim, the only simpler ones, often suck (especially ssmtp, which even the maintainer gave up on). What follows is how I got postfix working on my Ubuntu Feisty machine (should work on more recent version of Ubuntu as well):
sudo apt-get install postfix
sudo dpkg-reconfigure postfix
Here are the options to answer in order:
"satellite" (when given the list of configuration styles)
<your normal user> (where to forward root's mail to)
<your host name>
<your ISP's smtp server>
accept default (when asked what other domains to accept mail from)
No (default is no synchronous updates on mail queue)
127.0.0.0/8 (accept default unless you know what you are doing)
0 (mailbox limit)
+ (default)
all (default)
Reload or restart postfix, then do some testing:
sudo apt-get install mailx
echo test |mail -s "test mail sent to external" <a href="mailto:me@gmail.com">me@gmail.com</a>
echo test |mail -s "test mail sent to normal user" <normal user name>
echo test |mail -s "test mail sent to root" root
You should get an email to your external address. And if you run
you should see 2 emails there for you, one that was sent to root (but was directed to you, see /etc/aliases for why) and the other that was sent to you.
To have those mails sent to an external address instead (like your me@gmail.com address) do the following:
echo me@gmail.com > ~/.forward
Update (2007-07-19): When I changed ISPs, my new ISP did not like my From: address being david@centurion (I just named it after the case model). So I had to do the following. Add this to /etc/postfix/main.cf:
smtp_generic_maps = hash:/etc/postfix/generic
Add this to /etc/postfix/generic:
@centurion <a href="mailto:david@telus.net">david@telus.net</a>
I just made up an email address there to make it happy.
Don't forget to run sudo postmap /etc/postfix/generic
Recent comments