Getting Mail from the Server (POP3 or IMAP)


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 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. With all the e-mail on the server, an administrator only needs to back up one machine to keep permanent records of everyone's e-mail.

Fedora comes with software that is 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.

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 simpler of the two protocols for accessing mailboxes over networks.

Accessing Mailboxes in Linux

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:

 /var/spool/mail/jsmith 

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 (although 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.

Tip 

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.

Configuring IMAP and POP3 with Dovecot

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.

  1. Review the values set in the /etc/dovecot.conf file. For this example, I assume the defaults, so you can try dovecot without changing anything in this file. For the purpose of this example, the POP3 protocol is enabled, plain-text passwords are enabled from the standard /etc/passwd file, and PAM is used for anthentication. Read through the comments in the file to see if there are any settings you want to change.

  2. Turn on the dovecot service by typing the following (as root user):

     #  chkconfig dovecot on  

    (If dovecot is not installed, install it by typing yum install dovecot .)

  3. Start the POP service immediately by starting up the dovecot service as follows :

     # /etc/init.d/dovecot start 
  4. Open port 110 on your firewall, to allow other computers to request POP3 service on your mail server. If you were using POP3 with SSL support, you would open port 995 instead (or port 993 for IMAP over SSL). An easy way to open a port is through the Security Level and Firewall window (select System Administration Security Level and Firewall). Select Other ports and click the Add button to add 110 as the port and TCP and UDP as the protocols.

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

  • Password: theuserspassword

  • Protocol: POP3

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.

Note 

Keep in mind that regular POP3 and IMAP service uses plain text protocols to carry user names and passwords across the network. Depending on your network environment, this may pose a security threat.




Fedora 6 and Red Hat Enterprise Linux Bible
Fedora 6 and Red Hat Enterprise Linux Bible
ISBN: 047008278X
EAN: 2147483647
Year: 2007
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net