Courier IMAP and daemontools
Many of these settings are the defaults in the configuration files but if you don't read them in, the values are unset. Therefore we include them explicitly.
If you just install Courier with the standard settings all of this is taken care of. Our goal is to use our familiar working practices to run the software, hence the requirement to set these environment variables in our supervise scripts. As to why they take the values they do, read on:
Please note that some variables need to be set to 1 and some need to be set to YES in order to configure things...
In order for imapd to advertise STARTTLS support:
You must set COURIERTLS to the full path to couriertls.
You must set IMAP_STARTTLS to YES.
You can require STARTTLS by setting IMAP_TLS_REQUIRED to 1.
You can change the capabilities advertised after successful STARTTLS negotiation by setting IMAP_CAPABILITY_TLS. See the Courier docs.
General SSL stuff
You need to set TLS_PROTOCOL to either TLS1 or SSL3 depending on whether you want to use straight SSL or STARTTLS.
You need to set TLS_CERTFILE to the full path to your server certificate.
You need to set TLS_VERIFYPEER to NONE if you don't want to require a client certificate. Doing so is almost certainly the right thing.
You can configure imapd to support the IDLE extension, which allows clients to go to sleep and be woken by the server when something happens. This way new mail can be pushed to the client instead of the client polling for messages every so often. It's supported by Thunderbird and other clients.
You must include IDLE in value of IMAP_CAPABILITY.
You must set IMAP_ENHANCEDIDLE to 1.
You must set IMAP_USELOCKS to 1.
Set IMAP_EMPTYTRASH to 0 to prevent imapd from periodically emptying the trash..
Set IMAP_MOVE_EXPUNGE_TO_TRASH to allow "deleted" items to go to the trash instead of being removed outright.