Courier IMAP and daemontools
The courier way
The way courier works if you install it with the default settings is something like this.
imapd.rc reads imap.cnf and imports a bunch of variables into the environment. It then starts courierlogger.
courierlogger takes care of opening a connection to syslog and launching couriertcpd.
couriertcpd listens on the port defined in the environment and forks a copy of imaplogin for each connection.
(In fact couriertls may run here if you are using SSL.)
imaplogin reads various environment variables to decide what capabilities to advertise for the IMAP server. It reads authentication information from the client and passes them to authdaemond for verification.
Subject to successful authentication, imaplogin spawns imapd to Do Stuff in the user's mail store.
The important thing to note is that all these "config files" and startup scripts put values in the environment. This means that we can configure Courier to run under daemontools by making sure the settings we want are exported.