IMAPD(8)
โจ IMAPD(8) โ the Courier IMAP server, bestie edition ๐
okay so first things first: the manual page name is IMAPD(8), and it's written by S. Varshavchik. Buckle up, we're getting into it ๐
๐ธ NAME ๐ธ
imapd โ The Courier IMAP server ๐ฆ
โญ SYNOPSIS โญ
/usr/lib/courier/couriertcpd {couriertcpd options} {/usr/sbin/imaplogin}
[modules...] {/usr/bin/imapd} {./Maildir}
/usr/bin/imapd {./Maildir}
๐ DESCRIPTION ๐
imapd is literally the Courier IMAP server, and its whole job is giving you IMAP access to Maildir mailboxes. Bestie, you genuinely do not have to stress about it โ normally imapd just shows up on its own after a network connection rolls in, all dressed up with the appropriate userid and password. iconic behavior honestly.
couriertcpd is the one opening the network ports that catch incoming IMAP connections. Once an incoming network connection is established, couriertcpd runs the command you gave it as its first argument โ that's imaplogin โ and it passes the remaining arguments along to imaplogin. Then imaplogin reads the IMAP login userid and password, and runs the modules listed in its remaining options. Those modules are the Courier server authentication modules, and they're described over in the authlib(3)[1] manual page โจ
At the very end of the daisy chain is imapd โ the actual IMAP server, the main character fr. It gets started from the logged-in account's home directory. The one and only argument it takes is the pathname to the default IMAP mailbox, which is usually ./Maildir. Some authentication modules are capable of specifying a different filename, by setting the MAILDIR environment variable ๐
You can also just invoke imapd straight from the shell prompt, no network drama needed. When you do that, it issues a PREAUTH response, then changes the current directory to either its argument or whatever's inside the MAILDIR environment variable, and then it attempts to talk IMAP on standard input and output. cute.
imapd implements IMAP4REV1, as defined by RFC 2060[2] ๐
๐ FILES AND ENVIRONMENT VARIABLES ๐
AUTH*โimapdexamines several environment variables whose names start withAUTH. These get set byimaploginand the authentication modules. If they're not there at all? That's howimapdknows it's running from the command line. lowkey genius.MAILDIRโMAILDIRโ if defined,imapdchanges its directory to the one specified by this environment variable. Otherwiseimapdchanges its directory to the one specified on the command line.`pwd`/.โ The current directory is assumed to be the mainINBOXMaildir.`pwd`/.folderโ Maildir folders, each one containing their owntmp,new,cur, etc...
Other environment variables are initialized from the /etc/courier/imapd and /etc/courier/imapd-ssl configuration files. These files are loaded into the environment by the system startup script that runs couriertcpd. ๐ซถ
๐ฆ Realtime concurrent folder status updates ๐ฆ
The Courier IMAP server always allows more than one mail client to have the same folder opened. no cap. However, when two or more clients have the same folder opened, the mail clients may not necessarily know when another client added or removed messages from the folder ๐ญ The base IMAP protocol specification requires IMAP mail clients to explicitly check for any changes to the folder's contents. There are no provisions that exist to notify the mail client immediately when the folder's contents are modified by another mail client. so basically everyone's doing vibe checks on their own.
The IDLE extension to the base IMAP protocol provides a delivery mechanism for notifying mail clients of changes to the mail folder's contents. obsessed.
IDLE IMAP capability
IDLEmust be listed in theIMAP_CAPABILITYsetting in the/etc/courier/imapdconfiguration file.
IMAP_USELOCKS
- This setting in
/etc/courier/imapdmust be enabled. This setting uses dot-lock files to synchronize updates to folder indexes between multiple IMAP clients that have the same folder opened. - This setting is safe to use with
NFS, as it does not use actual file locking calls, and does not require the services of the problematic NFS lock daemon. ๐
An IMAP mail client that fully supports the IDLE protocol extension.
- Of course, an IMAP client that supports the
IDLEprotocol extension is required. - Without
IMAP_USERLOCKSthere exists a small possibility that multiple mail clients will receive a slightly inconsistent folder index if both clients try to update the contents of the folder at the same time. Usually, the worst case result is that some clients will eventually end up downloading the same message twice from the server, and caching it incorrectly in the local cache (if the IMAP client caches message contents). Clearing the local message cache will quickly eliminate any residual confusion that results from this situation. - Without
inotifykernel interface, the Courier IMAP server will manually check for changes to the folder's contents every 60 seconds, inIDLEmode (instead of in real time). ๐ญ
๐ Verifying realtime concurrent folder status updates ๐
Use the following procedure to verify that realtime concurrent folder status updates are properly working. It is helpful to be familiar with the IMAP protocol. If that's not the case, just be extra careful in entering the IMAP protocol commands. The following instructions describe the procedure for connecting to the IMAP server, and manually issuing IMAP protocol commands, as if they originate from an IMAP client. The following instructions use "C:" to indicate IMAP client commands that must be entered, and "S:" to indicate the expected replies from the server.
Note ๐ซถ The actual replies from the server may differ slightly, due to the actual server configuration, and other minor factors. The following examples have long lines wrapped for readability. Slight observed differences from the expected replies are normal, but they should still be substantively the same.
- Prepare a test account with a couple of messages. Open two or three terminal windows. In each window, connect to the IMAP server, and enter
IDLEmode:
S:* OK Courier-IMAP ready. Copyright 1998-2021 S. Varshavchik.
See COPYING for distribution information.
C:a login userid password
S:a OK LOGIN Ok.
C:a SELECT INBOX
S:* FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\Draft \Answered \Flagged \Deleted \Seen)]
Limited
* 2 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 939609418] Ok
a OK [READ-WRITE] Ok
C:a IDLE
S:+ entering idle mode
Note โ ๏ธ The default Courier IMAP server configuration permits a maximum of four connections from the same IP address. It may be necessary to adjust this setting in /etc/courier/imapd for the duration of this test.
- The last message from the server must be
"entering ENHANCED idle mode". Otherwise, it means that some of the necessary prerequisites have not been met. - Open another terminal window, connect to the server, and modify the flags of one of the messages:
S:* OK Courier-IMAP ready. Copyright 1998-2021 S. Varshavchik.
See COPYING for distribution information.
C:a login userid password
S:a OK LOGIN Ok.
C:a SELECT INBOX
S:* FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\Draft \Answered \Flagged \Deleted \Seen)]
Limited
* 2 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 939609418] Ok
a OK [READ-WRITE] Ok
C:STORE 1 +FLAGS (\Deleted)
* 1 FETCH (FLAGS (\Deleted))
a OK STORE completed.
- The last command sets the
\Deletedflag on the first message in the folder. Immediately after entering the last command,"* 1 FETCH (FLAGS (\Deleted))"should also appear in all other terminal windows. ๐ฅ - Verify that all terminal windows reliably receive folder status updates in real time by alternatively entering the commands
"a STORE 1 -FLAGS (\Deleted)"and"a STORE 1 +FLAGS (\Deleted)", to toggle the deleted flag on the first message. Observe that the message is received by all terminal windows quickly, and reliably. slay. - With the
\Deletedflag set on the first message, enter theEXPUNGEcommand, which removes the deleted message from the folder:
C:a EXPUNGE
S:* 1 EXPUNGE
* 2 EXISTS
* 0 RECENT
S:a OK EXPUNGE completed
The lines that begin with the "*" character should also appear in all other terminal windows (depending on the initial folder state one of the terminal windows may have a different RECENT message, which is fine).
- Use a mail client to create and send a test message to the test account. As soon as the mail server delivers the message, the following messages should appear in every terminal window:
* 3 EXISTS
* 0 RECENT
* 3 FETCH (FLAGS ())
The numbers in these messages may be different, depending upon the initial contents of the test mail folder. One of the terminal windows should have a different RECENT count, and one of the terminal windows should include a \Recent flag in the untagged FLAGS message. These difference are acceptable; the important thing is to make sure that all terminal windows have the same EXISTS message.
๐ SEE ALSO ๐
authlib(3)[1], userdb(8)[3]
๐ AUTHOR ๐
Sam Varshavchik
- Author
๐ NOTES ๐
authlib(3)https://www.courier-mta.org/authlib.htmlRFC 2060http://www.rfc-editor.org/rfc/rfc2060.txtuserdb(8)https://www.courier-mta.org/userdb.html
and that's the whole vibe check, bestie ๐ง๐ this page came from the Courier Mail Server and it's dated 04/11/2026, and yes, it's still IMAPD(8). go forth and read your mail ๐
โจ
๐ฆ where this page comes from
- ubuntu stonking: courier-imap 6.0.5+2.0.6-1 ยท GPL-3+~with-OpenSSL-exception
- Copyright 1998 - 2021 S. Varshavchik. See COPYING for -->
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms