Wednesday, April 09, 2008

Simple Mail Server (Kubuntu)

If you need a small personal mail server to send log reports and system alarms from your Kubuntu machines to a local and/or external mail address then you may use Exim4 that is the default mail server (MTA) that comes with (K)Ubuntu.

To install is very easy:


1 sudo aptitude install exim4 exim4-base



and to configure simply run:


1 sudo dpkg-reconfigure exim4-config



and in the first dialog (image below) select "internet site". For all next options I used the defaults that would allow local users and services to send emails locally and to remote addresses (i.e. gmail accounts).


Now to test the new server you can send a simple email to your Gmail account:


1 mail -s test mygmail@gmail.com

2 test mail

3 .

4 Cc:



The "-s" switch is the mail subject. After the command simply type whatever you want in the mail body. To finish the email press followed by a dot "." and then again. After this you will be prompted with "Cc:" so press and then check your Gmail account. You should have received an email with the message and subject you used above.

Now say you want to receive LogWatch reports or any other mail directed to root in your Gmail account. Then you can simply create an alias in the "/etc/aliases" file like:


1 # Added by installer for initial user

2 root:   mygmail@gmail.com



then rebuild the aliases database


1 sudo newaliases



If you require more complex mail configurations you may check my previous posts about Sendmail and Postfix setup in (K)Ubuntu here.

No comments:

Post a Comment