After you have set up your mail server, you will want to let users access their e-mail from that server. That means either having each user log in to the mail server to read his or her e-mail or, more likely, configuring Post Office Protocol (POP3) or IMAP to let users access their mail from their workstations. Here are descriptions of POP3 and IMAP:
POP3 — With POP3, users download and manage their e-mail messages on their local workstations. POP3 is simpler and requires fewer server resources.
IMAP — With IMAP, messages stay on the server, although you can manipulate those messages from the mail client. Because the messages stay on the server, an IMAP server requires more disk space and uses more CPU. However, you do have the advantage of logging in to different workstations to read your mail and having the mail and folders you have set up appear the same.
Fedora comes with two software packages that are able to provide POP3 and IMAP service. The dovecot package is primarily an IMAP server that also contains a small POP3 server. It supports mail in both maildir (where each mail account can contain multiple folders on the server) and mbox (where all messages are in a single file) formats.
The cyrus-imapd package was built to scale up to enterprise-level mail server technology. Many security features are built into cyrus-imapd, including the ability to run on sealed servers where mailbox storage and user access are tightly controlled by the server.
This section describes how to use POP3 to allow the users of your mail server to download their mail messages from your server over the network. POP3 is the more common and simpler of the two protocols for accessing mailboxes over networks.
When e-mail messages are received on your sendmail or postfix mail server, they are sorted to separate files, each of which represents a user’s mailbox. The default location of mailbox files is the /var/spool/mail directory. So the login account jsmith would have a mailbox:
While logged into the mail server, jsmith could simply type mail from a Terminal window to read his e-mail (using the simple, text-based mail command). However, because most people prefer to get their e-mail from the comfort of their own desktop computer, you can set up either Post Office Protocol (POP3) or Internet Message Access Protocol (IMAP).
POP3 and IMAP servers listen on the network for requests for a user’s e-mail, then either download the entire contents of the mailbox to the user’s mail reader (as with POP3) or let the user manage the messages while the messages stay on the server (as with IMAP).
Typically, your mail server will be configured to use either POP3 or IMAP to provide e-mail messages to your users (though it is possible to have both running on the same machine).
The next section tells how to set up an IMAP or POP3 service to allow access to e-mail accounts.
At times, you may want to check your e-mail on a computer that is not your regular computer, but be able to save messages later. In that case, most mail readers let you choose a setting that copies the e-mail messages without deleting them from your POP3 server. That way, when you get back to your regular computer, you can copy the messages again. IMAP avoids that problem by always keeping the mail messages on the server and letting the user create and work with additional folders on the server.
When a user is added to Fedora, a mailbox is configured under that user name in the /var/spool/mail directory (such as /var/spool/mail/chris). The format of that file, by default, is the traditional mbox format, with all messages and attachments stored in that one file. By configuring the POP3 service on your mail server, users will be able to download their e-mail messages from e-mail clients on other machines. By configuring IMAP, users can work with messages and folders directly on the server.
The following procedure describes how to configure the IMAP or POP3 service in Fedora using dovecot.
Review the values set in the /etc/dovecot.conf file. For this example, I assume the defaults, which include:
mbox — All mail is stored in one file. For IMAP servers, the Maildir style is used. Maildir stores each message in a separate file.
protocols — This sets which protocols to listen for. By default imap and imaps are on. You can add pop3 and pop3s, so that the line appears as follows:
protocols = imap imaps pop3 pop3s
auth_userdb = passwd — Although it is possible to use different authentication methods, the default is to simply authenticate the user’s name and password from the /etc/passwd file. The authentication method used is pam and passwords are used in plain text format. See /usr/share/doc/dovecot*/auth.txt for information on authentication types.
Turn on the dovecot service by typing the following (as root user):
# chkconfig dovecot on
Start the POP service immediately by starting up the dovecot service as follows:
# /etc/init.d/dovecot start
All users who have user accounts on your mail server are configured, by default, to accept e- mail. For example, if e-mail comes in to the mail.handsonhistory.com server for a user named jsmith, the message is copied to the /var/spool/mail/jsmith file on the server. Continuing the example, from jsmith’s computer, he could set up his mail reader as follows:
Mail server: mail.handsonhistory.com
User name: jsmith
After the mail reader is configured, when jsmith clicks Send & Receive from his mail reader, all e-mail messages in the /var/spool/mail/jsmith file are downloaded to his local mail reader. The messages are then erased from the server.
If none of your users are able to download messages from your mail server, verify that your firewall (iptables ) is configured to allow access to the POP service. By default, pop3 listens on port 110 and pop3 with ssl support listens on port 995.