Previous Section  < Day Day Up >  Next Section

Recipe 20.12. Building an IMAP Mail Server

20.12.1 Problem

Your users are a footloose lot, and they want to be able to log into their mail server from wherever they happen to be, see all their mail and folders, and not have to worry about having their mail scattered all over different PCs.

20.12.2 Solution

An IMAP server is one way to meet this need. (Webmail is another; see Recipe Recipe 20.18.) If you have an RPM-based sytem, like Fedora, and followed Recipe Recipe 20.2, you have an IMAP server installed. Debian users (Recipe Recipe 20.3) need to install two additional packages:

# apt-get install courier-imap courier-imap-ssl

Next, generate your TSL/SSL key, then start up the server:

# mkimapdcert

# /etc/init.d/courier-imap start

# /etc/init.d/courier-imap-ssl start

Check your init scripts for the exact filenames, as these vary on different Linux distributions.

Test it with telnet:

$ telnet localhost 143

Trying 127.0.0.1...

Connected to localhost.localdomain.

Escape character is '^]'.

* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT 

THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 

1998-2004 Double Precision, Inc.  See COPYING for distribution information.

a001 login carla sekritword

a001 OK LOGIN Ok.

a002 examine inbox

* FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)

* OK [PERMANENTFLAGS ( )] No permanent flags permitted

* 0 EXISTS

* 0 RECENT

* OK [UIDVALIDITY 1085106842] Ok

* OK [MYRIGHTS "acdilrsw"] ACL

a002 OK [READ-ONLY] Ok

a003 logout

* BYE Courier-IMAP server shutting down

a003 OK LOGOUT completed

Connection closed by foreign host.

To test your IMAP-over-TLS/SSL support, use:

$ openssl s_client -connect localhost:993

See RFC 3501 for a complete description of IMAP commands.

You now have a working IMAP server. See Recipe 20.13 for how to connect your users.

You must have the file alteration monitor daemon (famd) running, so that Maildir folders will continually update themselves. famd is standard on most Linux systems; run ps ax | grep famd to make sure it's running.


20.12.3 Discussion

You'll need something better than the antique Pentium you used in Recipe 20.2 because an IMAP server requires more horsepower and lots more storage space than a POP3 server. And you definitely do not want to share the box—let the IMAP server have it all to itself. Because hardware requirements vary according to user demand, precise calculations are difficult. As a general rule, a 1.5-GHz CPU, 256 MB RAM, and a 30-GB drive can serve 100 users. Keep an eye on disk space, as that is usually the first to go.

20.12.4 See Also

  • Local Courier documentation (/usr/share/doc/courier-doc/htmldoc/imapd.html)

  • RFC 3501, for a complete description of IMAP commands.

  • Recipe 20.13

    Previous Section  < Day Day Up >  Next Section