Installing and configuring Exim and Courier are very straightforward thanks to the quality of the packages that come with Ubuntu. It is possible that, if you have a new Ubuntu system, it already has a version of Exim installed. However, you'll want to use a specific version of Exim that contains features for content scanning. Here are the installation steps:
1. Start by installing this particular Exim package:
$ sudo apt-get install exim4-daemon-heavy
2. You need to change a few configuration options from the defaults. Run the following command:
$ sudo dpkg-reconfigure —priority=medium exim4-config
You are asked a number of questions. Here's how to answer them:
General type: Select "Mail sent by smarthost; received via SMTP or fetchmail" if you need to send all of your outgoing mail through a server at your Internet service provider. Otherwise, select "Internet site; mail is sent and received directly using SMTP."
Mail name: Enter the name of your mail server here.
IP addresses: Clear this box (or leave it empty if it is already so) so that Exim will listen on all local IP addresses.
Destinations to accept mail for: Enter any domains that your server will be accepting mail for. Be sure to separate them with colons, and not commas or spaces.
Domains to relay for: Enter the names of any domains that your machine will relay mail for, meaning that it can receive mail from them but then passes it on. In most cases, you will not want to enter anything here.
Machines to relay for: Enter the IP address ranges of any client machines that you want your server to accept mail from. Another (safer) option is to leave this empty and require clients to authenticate using SMTP authentication. SMTP authentication is best performed over an encrypted connection, so this process is described in the security section at the end of this chapter.
Rewrite headers: Select Yes if you want to hide the local mail name in outgoing mail by rewriting the From, Reply-To, Sender, and Return-Path values to a selected system name in outgoing mail. If Yes, you must then set the visible domain name for local users.
Split configuration into small files: Selecting Yes causes Exim to split configuration files into about 50 smaller files (instead of one big one) in the /etc/exim4/conf.d directory. Otherwise, the /etc/exim4/exim4.conf.template file is used as a single, monolithic file.
3. This configuration uses Maildrop for local mail delivery. Maildrop can deliver messages to the Maildir-style folders that Courier is expecting, and can also handle basic sorting and filtering (as described in the "Configuring Mail Clients" section). This package is not installed by default, so install it as follows:
$ sudo apt-get install maildrop
4. Create Maildir mail directories for every user already on the system. This step must be performed for every user that is already on the system, and must be run as the user because running this command as root will result in Maildrop being unable to write to the folders:
$ maildirmake.maildrop $HOME/Maildir $ maildirmake.maildrop -f Trash $HOME/Maildir
5. Create mail directories under /etc/skel . The contents of /etc/skel will be copied to the home directories of any new accounts that you create after the setup is completed:
$ sudo maildirmake.maildrop /etc/skel/Maildir $ sudo maildirmake.maildrop -f Trash /etc/skel/Maildir
6. Configure Maildrop to deliver to the Maildir folders instead of mbox files stored in /var/ spool/mail. Use your favorite text editor to edit /etc/maildroprc and uncomment this line at the end of the file:
7. Exim needs to be configured to deliver messages using Maildrop. Use your preferred text editor to open /etc/exim4/update-exim4.conf.conf and change the dc_localdelivery line at the end of the file to read as follows:
8. Tell Exim to load the most recent configuration change: $ sudo invoke-rc.d exim4 reload
9. Install Courier IMAP and Courier POP:
$ sudo apt-get install courier-imap courier-pop
10. Select "no" when asked whether or not the installer should create directories for Web-based administration.
Your system should now be capable of receiving messages. You should also be able to connect to your server using a mail client such as Thunderbird or Evolution. This is a good time to test mail delivery, even if you're planning to follow the directions in the next section to enable virus and spam filters later. More information about configuring a mail client to connect to your server can be found in the "Configuring Mail Clients" section later in this chapter.
Was this article helpful?
Although we usually tend to think of the digital camera as the best thing since sliced bread, there are both pros and cons with its use. Nothing is available on the market that does not have both a good and a bad side, but the key is to weigh the good against the bad in order to come up with the best of both worlds.