<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.yobi.be/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Twalrant</id>
	<title>YobiWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.yobi.be/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Twalrant"/>
	<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Special:Contributions/Twalrant"/>
	<updated>2026-05-26T00:18:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Server_Dell_PowerEdge_T410&amp;diff=6909</id>
		<title>Server Dell PowerEdge T410</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Server_Dell_PowerEdge_T410&amp;diff=6909"/>
		<updated>2010-11-30T07:33:54Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* XEN quickref */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Manuals==&lt;br /&gt;
* [http://support.dell.com/support/edocs/systems/peT410/ here], online version of the main manual [http://support.dell.com/support/edocs/systems/peT410/en/HOM/html/index.htm here] with chapter on LED status [http://support.dell.com/support/edocs/systems/peT410/en/HOM/html/about.htm#wp1194212 here]&lt;br /&gt;
&lt;br /&gt;
==Install notes==&lt;br /&gt;
===BIOS===&lt;br /&gt;
** Activate Virtualization support&lt;br /&gt;
** Power Management -&amp;gt; OS Control&lt;br /&gt;
** Report kbd errors: NO&lt;br /&gt;
===Debian Squeeze===&lt;br /&gt;
Still testing at time of writing but frozen so almost stable ;-)&lt;br /&gt;
* Installing squeeze [http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/amd64/iso-cd/debian-testing-amd64-netinst.iso from daily image] (17/08/2010)&lt;br /&gt;
** Complains about missing bnx2/bnx2-mips-09-5.0.0.j3.fw &amp;amp; bnx2/bnx2-rv2p-09-5.0.0.j3.fw&lt;br /&gt;
*** Get it on another machine and put it on USB stick: aptitude install firmware-bnx2 ; cp /lib/firmware/bnx2/bnx2-*-09-5.0.0.j3.fw /media/XXXX&lt;br /&gt;
*** Actually I had also an additional Intel network card so I could have skipped this step...&lt;br /&gt;
** Partitionning: &amp;lt;br&amp;gt;there is a first primary partition for Dell Utilities (FAT16), I left it just in case...; &amp;lt;br&amp;gt;there is also a second primary partition: 2Gb of FAT32, empty, so I deleted it. &amp;lt;br&amp;gt;partition #2: primary 10Gb ext3 / label=ROOT&amp;lt;br&amp;gt;partition #3: primary 16Gb swap&amp;lt;br&amp;gt;partition #5: logical 2Tb physical volume for LVM&amp;lt;br&amp;gt;Configure LVM / ok to write table / Create VG with sda5, called vg0 (will be used by XEN)&lt;br /&gt;
** Tasksel: SSH &amp;amp; standard utilities&lt;br /&gt;
** Reboot&lt;br /&gt;
* SSH: PermitRootLogin no / ssh-copy-id ...&lt;br /&gt;
* Install mc, screen, sudo (adduser xxx sudo)&lt;br /&gt;
* Renaming interfaces (always easier to remember what&#039;s plugged where...)&lt;br /&gt;
** à la ifrename&lt;br /&gt;
*** aptitude install ifrename&lt;br /&gt;
*** Create /etc/iftab then reboot&lt;br /&gt;
 intelG mac 00:1b:21:xx:xx:xx&lt;br /&gt;
 intelD mac 00:1b:21:xx:xx:xx&lt;br /&gt;
 bcm1   mac 84:2b:2b:xx:xx:xx&lt;br /&gt;
 bcm2   mac 84:2b:2b:xx:xx:xx&lt;br /&gt;
** à la udev&lt;br /&gt;
*** actually we don&#039;t need ifrename because udev is now doing the same, see /etc/udev/rules.d/70-persistent-net.rules, you can simply change the NAME key&lt;br /&gt;
** Be sure the old name is not used anywhere else in your config, typically in /etc/network/interfaces&lt;br /&gt;
&lt;br /&gt;
===XEN: installation===&lt;br /&gt;
* see [http://wiki.debian.org/Xen notes on Debian wiki]&lt;br /&gt;
* aptitude install xen-linux-image-2.6.32-5-xen-amd64 xen-tools xen-utils&lt;br /&gt;
* backup /etc/xen/xend-config.sxp&lt;br /&gt;
* edit /etc/xen/xend-config.sxp, and uncomment line &amp;quot;(network-script network-bridge)&amp;quot; or for a non-default interface ethX:&lt;br /&gt;
 (network-script &#039;network-bridge netdev=ethX bridge=xenbr0&#039;)&lt;br /&gt;
* reboot&lt;br /&gt;
* aptitude remove --purge linux-image-2.6.32-5-amd64 linux-image-2.6-amd64&lt;br /&gt;
* /etc/default/grub =&amp;gt;  GRUB_DEFAULT=2&lt;br /&gt;
* update-grub&lt;br /&gt;
* reboot&lt;br /&gt;
* cat /proc/xen/capabilities #(to check xend is running)&lt;br /&gt;
&lt;br /&gt;
===XEN: guest creation===&lt;br /&gt;
* If you&#039;ve a proxy it&#039;s much easier to have it defined in the environment variables:&lt;br /&gt;
** Edit /etc/environment&lt;br /&gt;
 http_proxy=http://myproxy:port&lt;br /&gt;
** Logout/login&lt;br /&gt;
* Edit the config file for creating images (/etc/xen-tools/xen-tools.conf) to your needs:&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- xen-tools.conf.orig 2010-05-30 22:42:25.000000000 +0200&lt;br /&gt;
+++ xen-tools.conf      2010-08-17 17:47:35.000000000 +0200&lt;br /&gt;
@@ -52,7 +52,7 @@&lt;br /&gt;
 # LVM volume group here instead&lt;br /&gt;
 #&lt;br /&gt;
 ##&lt;br /&gt;
-# lvm = vg0&lt;br /&gt;
+lvm = vg0&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
@@ -125,12 +125,12 @@&lt;br /&gt;
 #  Disk and Sizing options.&lt;br /&gt;
 ##&lt;br /&gt;
 #&lt;br /&gt;
-size   = 4Gb      # Disk image size.&lt;br /&gt;
+size   = 8Gb      # Disk image size.&lt;br /&gt;
 memory = 128Mb    # Memory size&lt;br /&gt;
 swap   = 128Mb    # Swap size&lt;br /&gt;
 # noswap = 1      # Don&#039;t use swap at all for the new system.&lt;br /&gt;
 fs     = ext3     # use the EXT3 filesystem for the disk image.&lt;br /&gt;
-dist   = `xt-guess-suite-and-mirror -s` # Default distribution to install.&lt;br /&gt;
+dist   = squeeze  # Default distribution to install.&lt;br /&gt;
 image  = sparse   # Specify sparse vs. full disk images.&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
@@ -166,7 +166,7 @@&lt;br /&gt;
 #&lt;br /&gt;
 # Uncomment this if you wish the images to use DHCP&lt;br /&gt;
 #&lt;br /&gt;
-# dhcp = 1&lt;br /&gt;
+dhcp = 1&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ##&lt;br /&gt;
@@ -184,7 +184,7 @@&lt;br /&gt;
 # Uncomment the following line if you wish to interactively setup&lt;br /&gt;
 # a new root password for images.&lt;br /&gt;
 #&lt;br /&gt;
-# passwd = 1&lt;br /&gt;
+passwd = 1&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # If you&#039;d like all accounts on your host system which are not present&lt;br /&gt;
@@ -254,10 +254,10 @@&lt;br /&gt;
 #&lt;br /&gt;
 #  You may specify the things to use here:&lt;br /&gt;
 #&lt;br /&gt;
-# serial_device = hvc0 #default&lt;br /&gt;
+serial_device = hvc0 #default&lt;br /&gt;
 # serial_device = tty1&lt;br /&gt;
 #&lt;br /&gt;
-# disk_device = xvda #default&lt;br /&gt;
+disk_device = xvda #default&lt;br /&gt;
 # disk_device = sda&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==XEN quickref==&lt;br /&gt;
[http://xen-tools.org/software/xen-tools/ Xen Tools], [http://xen-tools.org/software/xen-shell Xen Shell]&lt;br /&gt;
&lt;br /&gt;
See also [http://www.howtoforge.com/virtualization-with-xen-on-debian-lenny-amd64-p2 here] and [http://www.howtoforge.com/xen_tools_xen_shell_argo here]&lt;br /&gt;
&lt;br /&gt;
* xen-create-image --hostname=mynewguest&lt;br /&gt;
* xen-delete-image&lt;br /&gt;
* xen-list-images&lt;br /&gt;
* xen-update-image # apt-get update; apt-get upgrade in the guest, !!! only if guest is NOT running&lt;br /&gt;
* xm create /etc/xen/mynewguest.cfg&lt;br /&gt;
* xm list # Show running xen guests&lt;br /&gt;
* xm info # Show xen version and many other info&lt;br /&gt;
* xm console mynewguest&lt;br /&gt;
** CTRL+] to detach&lt;br /&gt;
* xm shutdown mynewguest&lt;br /&gt;
* xm destroy mynewguest&lt;br /&gt;
&lt;br /&gt;
If you want xen1.example.com to start automatically at the next boot of the system, then do this:&lt;br /&gt;
&lt;br /&gt;
ln -s /etc/xen/xen1.example.com.cfg /etc/xen/auto&lt;br /&gt;
&lt;br /&gt;
==Sagemath guest==&lt;br /&gt;
* xen-create-image --hostname=sagemath --memory=12288 --swap=12288 --vcpus=20&lt;br /&gt;
* WARNING strangely the default root password was disabled with a &#039;*&#039; in /etc/shadow so impossible to log in. I had to mount manually the lv (/dev/vg0/sagemath-disk) to remove the &#039;*&#039;&amp;lt;br&amp;gt;One may prefer to setup the password interactively when creating the image with xen-create-image ... --passwd (or setup passwd=1 in /etc/xen-tools/xen-tools.conf as I&#039;ve now shown in the above diff file)&lt;br /&gt;
* lvm&amp;gt; lvcreate -L 1000G -n sagemath-data vg0&lt;br /&gt;
* /etc/xen/sagemath.cfg: add data volume:&lt;br /&gt;
 root        = &#039;/dev/xvda2 ro&#039;&lt;br /&gt;
 disk        = [&lt;br /&gt;
                   &#039;phy:/dev/vg0/sagemath-disk,xvda2,w&#039;,&lt;br /&gt;
                   &#039;phy:/dev/vg0/sagemath-swap,xvda1,w&#039;,&lt;br /&gt;
                   &#039;phy:/dev/vg0/sagemath-data,xvda3,w&#039;,&lt;br /&gt;
               ]&lt;br /&gt;
&lt;br /&gt;
* xm create -c /etc/xen/sagemath.cfg&lt;br /&gt;
* Hook the data drive as /home&lt;br /&gt;
** mkfs.ext4 /dev/xvda3&lt;br /&gt;
** In /etc/fstab: /dev/xvda3 /home ext4 noatime,nodiratime,errors=remount-ro 0 1&lt;br /&gt;
** mount /home&lt;br /&gt;
* Install sage&lt;br /&gt;
** apt-get install aria2&lt;br /&gt;
** cd /opt&lt;br /&gt;
** aria2c http://www.sagemath.org/mirror/linux/64bit/meta/sage-4.5.2-linux-64bit-ubuntu_10.04_lts-x86_64-Linux.tar.lzma.metalink&lt;br /&gt;
** tar x --lzma -f sage-4.5.2-linux-64bit-ubuntu_10.04_lts-x86_64-Linux.tar.lzma&lt;br /&gt;
** cd sage-4.5.2-linux-64bit-ubuntu_10.04_lts-x86_64-Linux&lt;br /&gt;
** Edit sage and set SAGE_ROOT=&amp;quot;/opt/sage-4.5.2-linux-64bit-ubuntu_10.04_lts-x86_64-Linux&amp;quot;&lt;br /&gt;
** ./sage&lt;br /&gt;
** sage&amp;gt; notebook.setup()&amp;lt;br&amp;gt;Provide FQDN for TLS certificate generation&lt;br /&gt;
==Misc notes==&lt;br /&gt;
===Boot &amp;amp; DHCP===&lt;br /&gt;
I&#039;ve still sometimes some issues at boot time when the xenbr0 bridge doesn&#039;t catch its IP...&lt;br /&gt;
&amp;lt;br&amp;gt;In those cases I find dhclient still hooked to the non-existing bnx1 IF (which was renamed pbnx1 by XEN). I&#039;ve to kill it and start a similar dhclient on IF xenbr0.&lt;br /&gt;
&amp;lt;br&amp;gt;Finally I renamed the default interface as eth0 and called the xen bridge script without parameters: (network-script network-bridge)&lt;br /&gt;
&lt;br /&gt;
===Allocating too much memory===&lt;br /&gt;
I tried to create two guests with each 12Gb of RAM while the host had only 16Gb in total. I would have expected a nice handling of the error but it froze xend and I could even not shutdown properly.&lt;br /&gt;
&amp;lt;br&amp;gt;And, oh, BTW, no, [http://blog.coparsystems.com/?p=36&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1 xen doesn&#039;t support memory overcommitment]&lt;br /&gt;
&lt;br /&gt;
===Hyperthreading===&lt;br /&gt;
I&#039;m not sure if in the long run it&#039;ll help but given that there are already 12 CPUs, I&#039;ve disabled the logical CPU support in the BIOS.&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=OutlookGnuPG&amp;diff=6022</id>
		<title>OutlookGnuPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=OutlookGnuPG&amp;diff=6022"/>
		<updated>2009-11-07T19:23:44Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OutlookGnuPG is now hosted at GitHub, see http://wiki.github.com/twalrant/OutlookGnuPG&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=OutlookGnuPG&amp;diff=6006</id>
		<title>OutlookGnuPG</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=OutlookGnuPG&amp;diff=6006"/>
		<updated>2009-11-02T18:59:04Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: Created page with &amp;#039;Placeholder for a fork of the OutlookGnuPG add-in originally developped by [http://blog.cumps.be/gpg-in-outlook-2007-outlookgnupg/ David Cumps].  Source available at [http://git.…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Placeholder for a fork of the OutlookGnuPG add-in originally developped by [http://blog.cumps.be/gpg-in-outlook-2007-outlookgnupg/ David Cumps].&lt;br /&gt;
&lt;br /&gt;
Source available at [http://git.yobi.be/?p=OutlookGnuPG.git;a=summary OutlookGnuPG]&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Virtual_Private_Networks&amp;diff=5339</id>
		<title>Virtual Private Networks</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Virtual_Private_Networks&amp;diff=5339"/>
		<updated>2009-01-06T09:51:44Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Setup on the Linux server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[http://openvpn.net/ OpenVPN]==&lt;br /&gt;
===Intro===&lt;br /&gt;
* [http://openvpn.net/howto.html Reference: OpenVPN Howto]&lt;br /&gt;
* [http://openvpn.se/ OpenVPN GUI for Windows]&lt;br /&gt;
* apt-get install openvpn&lt;br /&gt;
* transport is done with TLS over tcp or udp, default port 1194&lt;br /&gt;
&lt;br /&gt;
=== Setup of a VPN server for multiple dynamic clients with certificates===&lt;br /&gt;
Thanks to Thierry Walrant for his contribution!&lt;br /&gt;
====Characteristics of this setup====&lt;br /&gt;
* Ethernet tunneling (tap) over TCP port 1194&lt;br /&gt;
* Full redirection of the traffic (redirection of the default gateway and DNS server), NATed by server towards Internet&lt;br /&gt;
* Security by certificates&lt;br /&gt;
* Works with Linux or Windows clients&lt;br /&gt;
* Dynamic handling (à la DHCP) of the clients&lt;br /&gt;
* Allows other ipsec VPN softwares to run on top (e.g. enterprise ipsec VPN for Windows)&lt;br /&gt;
====Setup of the Certificate Authority (CA)====&lt;br /&gt;
The CA should be another computer than the server!&lt;br /&gt;
 cp -a /usr/share/doc/openvpn/examples/easy-rsa /etc/openvpn&lt;br /&gt;
 cd /etc/openvpn/easy-rsa&lt;br /&gt;
Edit the file called vars and adapt the last KEY_xxx vars to your needs&lt;br /&gt;
 . vars&lt;br /&gt;
 ./clean-all&lt;br /&gt;
 ./build-ca&lt;br /&gt;
To create a certificate and sign it in one single step (do that only if the certificate can be transferred to the client via a secure channel, otherwise generate the certificate and the request on the client and sign it on the CA), without password:&lt;br /&gt;
*For the server, use (don&#039;t forget to give a Common Name):&lt;br /&gt;
 ./build-key-server &#039;&#039;server-cert&#039;&#039;&lt;br /&gt;
*For a client: (don&#039;t forget to give a Common Name)&lt;br /&gt;
 ./build-key &#039;&#039;client-cert&#039;&#039;&lt;br /&gt;
For other situations, see easy-rsa/README.gz&lt;br /&gt;
&amp;lt;br&amp;gt;To see content of a certificate:&lt;br /&gt;
 openssl x509 -in cert.crt -text&lt;br /&gt;
====Setup on the Linux server====&lt;br /&gt;
Setup of ip forward&lt;br /&gt;
* Uncomment the following line in /etc/sysctl.conf&lt;br /&gt;
 net/ipv4/ip_forward=1&lt;br /&gt;
* To try immediately&lt;br /&gt;
 echo 1 &amp;gt;/proc/sys/net/ipv4/ip_forward&lt;br /&gt;
Import the server certificate and its key (securely!) as well as the CA certificate&lt;br /&gt;
* CA:/etc/openvpn/easy-rsa/keys/ca.crt -&amp;gt; server:/etc/openvpn/ca.crt&lt;br /&gt;
* CA:/etc/openvpn/easy-rsa/keys/&#039;&#039;server-cert&#039;&#039;.crt -&amp;gt; server:/etc/openvpn/&#039;&#039;server-cert&#039;&#039;.crt&lt;br /&gt;
* CA:/etc/openvpn/easy-rsa/keys/&#039;&#039;server-cert&#039;&#039;.key -&amp;gt; server:/etc/openvpn/&#039;&#039;server-cert&#039;&#039;.key&lt;br /&gt;
Create the DH keys via etc-rsa/build-dh or directly with&lt;br /&gt;
 openssl dhparam -out dh2048.pem 2048&lt;br /&gt;
Create /etc/openvpn/iptables.up and make it executable:&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 SOURCE=$1&lt;br /&gt;
 DEV=$2&lt;br /&gt;
 # establishing Source NATing (hiding source address)&lt;br /&gt;
 /sbin/iptables -t nat -A POSTROUTING -s $SOURCE -d 0.0.0.0/0 -j SNAT --to-source=&amp;lt;ext_ip&amp;gt;&lt;br /&gt;
 # allowing explicitely to forward traffic from NATed interface in Netfilter (not needed if your policy allows all by default)&lt;br /&gt;
 /sbin/iptables -I FORWARD -i &amp;lt;ext_if&amp;gt; -o $DEV -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 /sbin/iptables -I FORWARD -i $DEV -o &amp;lt;ext_if&amp;gt; -j ACCEPT&lt;br /&gt;
Create /etc/openvpn/iptables.down and make it executable:&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 SOURCE=$1&lt;br /&gt;
 DEV=$2&lt;br /&gt;
 /sbin/iptables -D FORWARD -i $DEV -o &amp;lt;ext_if&amp;gt; -j ACCEPT&lt;br /&gt;
 /sbin/iptables -D FORWARD -i &amp;lt;ext_if&amp;gt; -o $DEV -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 /sbin/iptables -t nat -D POSTROUTING -s $SOURCE -d 0.0.0.0/0 -j SNAT --to-source=&amp;lt;ext_ip&amp;gt;&lt;br /&gt;
Create /etc/openvpn/server.conf:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
proto tcp&lt;br /&gt;
dev tap0&lt;br /&gt;
ca                    /etc/openvpn/ca.crt&lt;br /&gt;
cert                  /etc/openvpn/server-cert.crt&lt;br /&gt;
key                   /etc/openvpn/server-cert.key&lt;br /&gt;
dh                    /etc/openvpn/dh2048.pem&lt;br /&gt;
server                172.16.0.0 255.255.0.0&lt;br /&gt;
ifconfig-pool-persist /etc/openvpn/ipp.txt&lt;br /&gt;
push                  &amp;quot;redirect-gateway&amp;quot;&lt;br /&gt;
push                  &amp;quot;dhcp-option DNS &amp;lt;primary_DNS&amp;gt;&amp;quot;&lt;br /&gt;
push                  &amp;quot;dhcp-option DNS &amp;lt;secondary_DNS&amp;gt;&amp;quot;&lt;br /&gt;
keepalive             10 120&lt;br /&gt;
comp-lzo&lt;br /&gt;
max-clients           10&lt;br /&gt;
status                /var/log/openvpn-status.log&lt;br /&gt;
verb                  3&lt;br /&gt;
mute                  20&lt;br /&gt;
up                    &amp;quot;/etc/openvpn/iptables.up 172.16.0.0/16&amp;quot;&lt;br /&gt;
down                  &amp;quot;/etc/openvpn/iptables.down 172.16.0.0/16&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will start at boot time, for a first try: /etc/init.d/openvpn start&lt;br /&gt;
&lt;br /&gt;
With option ifconfig-pool-persist, clients will always get the same IP.&lt;br /&gt;
&amp;lt;br&amp;gt;IPs are stored in /etc/openvpn/ipp.txt&lt;br /&gt;
&amp;lt;br&amp;gt;You can modify IP attributions by editing the file after having stopped the openvpn daemon, this is very important otherwise openvpn will overwrite your changes when it&#039;s stopped.&lt;br /&gt;
&lt;br /&gt;
====Setup on a Windows client====&lt;br /&gt;
* [http://openvpn.net/download.html Download] the windows installer and run it.&lt;br /&gt;
* You can try the [http://openvpn.se/ GUI]&lt;br /&gt;
====Setup on a Linux client====&lt;br /&gt;
To avoid automatic starting of the tunnel at boot time, edit /etc/default/openvpn: &lt;br /&gt;
 AUTOSTART=&amp;quot;none&amp;quot;&lt;br /&gt;
Bring the needed certificate files in e.g.:&lt;br /&gt;
* /etc/openvpn/cacerts/cacert.pem&lt;br /&gt;
* /etc/openvpn/certs/openvpn-myclient.crt.pem&lt;br /&gt;
* /etc/openvpn/private/openvpn-myclient.key.pem&lt;br /&gt;
Give read access to them only to root, especially the key file!&lt;br /&gt;
&amp;lt;br&amp;gt;Create a configuration file to join the server &amp;quot;&#039;&#039;myserver&#039;&#039;&amp;quot;: /etc/openvpn/&#039;&#039;myserver&#039;&#039;.conf&amp;lt;br&amp;gt;See the [http://openvpn.net/howto.html howto] for an explanation of the different options.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client&lt;br /&gt;
proto                 tcp&lt;br /&gt;
remote                &amp;lt;IP_or_FQDN_of_myserver&amp;gt; 1194&lt;br /&gt;
dev                   tap&lt;br /&gt;
resolv-retry          infinite&lt;br /&gt;
nobind&lt;br /&gt;
http-proxy-retry&lt;br /&gt;
http-proxy            &amp;lt;local_http_proxy_we_have_to_passthrough&amp;gt; &amp;lt;proxy_port&amp;gt;&lt;br /&gt;
ca                    /etc/openvpn/cacerts/cacert.pem&lt;br /&gt;
cert                  /etc/openvpn/certs/openvpn-myclient.crt.pem&lt;br /&gt;
key                   /etc/openvpn/private/openvpn-myclient.key.pem&lt;br /&gt;
ns-cert-type          server&lt;br /&gt;
comp-lzo&lt;br /&gt;
verb                  3&lt;br /&gt;
status                /var/log/openvpn.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run it manually&lt;br /&gt;
 /etc/init.d/openvpn start &#039;&#039;myserver&#039;&#039;&lt;br /&gt;
There is no automatic redefinition of the DNS servers under Linux, so we need a little trick (as [http://www.smop.co.uk/node/69 seen here]):&lt;br /&gt;
&amp;lt;br&amp;gt;Be sure to have the resolvconf package.&lt;br /&gt;
&amp;lt;br&amp;gt;Add the following to the config file of the client:&lt;br /&gt;
 up /etc/openvpn/domain.up&lt;br /&gt;
 plugin /usr/lib/openvpn/openvpn-down-root.so /etc/openvpn/domain.down&lt;br /&gt;
 # this is required for new openvpn versions &amp;gt;= 2.1~rc9&lt;br /&gt;
 script-security       2&lt;br /&gt;
Create /etc/openvpn/domain.up and make it executable:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# really naff script to add nameserver entry on up&lt;br /&gt;
DEV=$1&lt;br /&gt;
set | sed -n &amp;quot;&lt;br /&gt;
s/^foreign_option_.* DNS \(.*\)&#039;/nameserver \1/; T next; p;&lt;br /&gt;
:next; s/^foreign_option_.* DOMAIN \(.*\)&#039;/domain \1/; T; p;&lt;br /&gt;
&amp;quot; | resolvconf -a $DEV&lt;br /&gt;
resolvconf -u&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Create /etc/openvpn/domain.down and make it executable:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# really naff script to delete nameserver entry on down&lt;br /&gt;
DEV=$1&lt;br /&gt;
resolvconf -d $DEV&lt;br /&gt;
resolvconf -u&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you are not using Debian, see http://forums.gentoo.org/viewtopic-t-233080.html#1655552&lt;br /&gt;
&lt;br /&gt;
=== Setup of a VPN server in a vserver===&lt;br /&gt;
*cf http://linux-vserver.org/Frequently_Asked_Questions#Can_I_run_an_OpenVPN_Server_in_a_guest.3F&lt;br /&gt;
*You&#039;ve to use persistent tun/tap, cf [[Vserver administration]]&lt;br /&gt;
*You cannot dynamically modify iptables, this has to be done on the host.&lt;br /&gt;
*You&#039;ve to create manually /dev/net/tun in the vserver:&lt;br /&gt;
 cd &amp;lt;vserver&amp;gt;/dev; ./MAKEDEV tun&lt;br /&gt;
*I had also to give NET_ADMIN [http://linux-vserver.org/Capabilities_and_Flags capability] to the vserver&lt;br /&gt;
 echo NET_ADMIN &amp;gt;&amp;gt; /etc/vservers/&amp;lt;vserver&amp;gt;/bcapabilities&lt;br /&gt;
=== Using CACert certificates with OpenVPN===&lt;br /&gt;
Instead of creating your own CA you can rely on e.g. the CACert one.&lt;br /&gt;
====Server side====&lt;br /&gt;
Create a server certificate and get it signed by CACert&lt;br /&gt;
&amp;lt;br&amp;gt;server.conf will contain:&lt;br /&gt;
 ca                    /etc/openvpn/CAcert_chain.pem&lt;br /&gt;
 cert                  /etc/openvpn/your_server.pem&lt;br /&gt;
 key                   /etc/openvpn/your_privatekey.pem&lt;br /&gt;
 tls-verify            /etc/openvpn/verify-cn&lt;br /&gt;
We don&#039;t want to accept ALL CACert signed certificate therefore verify-cn is a little script which is called every time to check a client certificat, cf man openvpn:&lt;br /&gt;
  --tls-verify cmd&lt;br /&gt;
              Execute  shell  command cmd to verify the X509 name of a pending TLS&lt;br /&gt;
              connection that has otherwise passed all other tests  of  certifica-&lt;br /&gt;
              tion  (except for revocation via --crl-verify directive; the revoca-&lt;br /&gt;
              tion test occurs after the --tls-verify test).&lt;br /&gt;
 &lt;br /&gt;
              cmd should return 0 to allow the TLS handshake to proceed, or  1  to fail.  cmd is executed as&lt;br /&gt;
 &lt;br /&gt;
              cmd certificate_depth X509_NAME_oneline&lt;br /&gt;
[{{#file:verify-cn}} verify-cn]:&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash &lt;br /&gt;
&lt;br /&gt;
# clients file must contain one client subject per line (grep regexp actually)&lt;br /&gt;
&lt;br /&gt;
logfile=/etc/openvpn/verify-cn.log&lt;br /&gt;
clients=/etc/openvpn/verify-cn.allow&lt;br /&gt;
&lt;br /&gt;
CA=&amp;quot;/O=Root_CA/OU=http://www.cacert.org/CN=CA_Cert_Signing_Authority/emailAddress=support@cacert.org&amp;quot;&lt;br /&gt;
&lt;br /&gt;
case &amp;quot;$1&amp;quot; in&lt;br /&gt;
    1)&lt;br /&gt;
        [ &amp;quot;$2&amp;quot; == &amp;quot;$CA&amp;quot; ] &amp;amp;&amp;amp; exit 0&lt;br /&gt;
    ;;&lt;br /&gt;
    0)&lt;br /&gt;
        echo $2 | grep -q -f $clients &amp;amp;&amp;amp; exit 0;&lt;br /&gt;
    ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;$(date +%Y%m%d-%H%M%S) FAILED: $*&amp;quot; &amp;gt;&amp;gt; $logfile&lt;br /&gt;
exit 1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Example of verify_cn.allow:&lt;br /&gt;
 /CN=CAcert_WoT_User/emailAddress=my@email.org&lt;br /&gt;
&lt;br /&gt;
====Client side====&lt;br /&gt;
Create a client certificate and get it signed by CACert&lt;br /&gt;
&amp;lt;br&amp;gt;openvpn connection .conf will contain:&lt;br /&gt;
 ca                    /etc/openvpn/cacerts/CAcert_chain.pem&lt;br /&gt;
 cert                  /etc/openvpn/certs/my@email.org.crt.pem&lt;br /&gt;
 key                   /etc/openvpn/private/my@email.org.key.pem&lt;br /&gt;
 tls-remote            /CN=myvpn.mydomain.be&lt;br /&gt;
 #Fails on CACert certificates:&lt;br /&gt;
 #ns-cert-type          server&lt;br /&gt;
We don&#039;t want to accept ALL CACert signed certificate for the servers therefore we use the --tls-remote option and we specify the subject line of the server certificate we expect.&lt;br /&gt;
&amp;lt;br&amp;gt;Note that normally specifying the common_name instead of the subject line should be enough but this does not work on CACert certificates, cf my [http://bugs.debian.org/483472 bugreport]&lt;br /&gt;
&amp;lt;br&amp;gt;Note that we cannot use the --ns-cert-type option anymore as it also fails on CACert certificates, cf my other [http://bugs.debian.org/483473 bugreport]&lt;br /&gt;
&lt;br /&gt;
==[http://vtun.sourceforge.net/ vtun]==&lt;br /&gt;
&lt;br /&gt;
Older and with less features than openvpn but very easy to use for basic tunneling (tun or tap)&lt;br /&gt;
&lt;br /&gt;
* apt-get install vtun&lt;br /&gt;
* transport is done over tcp or udp, default port 5000&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5290</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5290"/>
		<updated>2008-11-06T10:07:59Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Offlineimap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;br /&gt;
&lt;br /&gt;
=Offlineimap=&lt;br /&gt;
Requires python, so run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package python.&lt;br /&gt;
&lt;br /&gt;
Download offlineimap [http://software.complete.org/software/projects/list_files/offlineimap here]. I use [http://software.complete.org/software/versions/download/242?attachment_id=334 version 6.0.3]. Extract files in you favorite sandbox.&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz offlineimap_6.0.3.tar.gz&lt;br /&gt;
 $ cd offlineimap&lt;br /&gt;
&lt;br /&gt;
Apply the following [{{#file:offlineimap_6.0.3-cygwin.patch}} patch] to correct the following issues:&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Maildir#Windows_software Suffix separator] character colon (:) is not allowed in Windows. Courier-imap for cygwin is using (!)&lt;br /&gt;
* While used by courier-imap for cygwin Maildir mail files should not use CRLF, rather only LF. The issue appears only in mail with attachment, that is the raw message is not interpreted and displayed as it in the mail body (under Thunderbird).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- offlineimap.conf	2008-08-13 20:56:04.000000000 +0200&lt;br /&gt;
+++ offlineimap-cygwin.conf	2008-11-06 10:44:31.066750700 +0100&lt;br /&gt;
@@ -215,6 +215,19 @@&lt;br /&gt;
 &lt;br /&gt;
 restoreatime = no&lt;br /&gt;
 &lt;br /&gt;
+# Cygwin/Windows users may have issues with the Maildir mail filename&lt;br /&gt;
+# containing the suffix separator character (:). In this case, they&lt;br /&gt;
+# could change the suffix separator character to whatever required.&lt;br /&gt;
+# For example, Courier-IMAP for Cygwin is using (!)&lt;br /&gt;
+&lt;br /&gt;
+# suffixsep = !&lt;br /&gt;
+&lt;br /&gt;
+# Cygwin/Windows users may need to create Maildir mail filename in&lt;br /&gt;
+# binary mode. In this case, set the &#039;filemode&#039; to &#039;binary&#039;. Default is&lt;br /&gt;
+# &#039;text&#039;. Courier-IMAP for Cygwin works better with binary mode.&lt;br /&gt;
+&lt;br /&gt;
+# filemode = binary&lt;br /&gt;
+&lt;br /&gt;
 [Repository RemoteExample]&lt;br /&gt;
 &lt;br /&gt;
 # And this is the remote repository.  We only support IMAP or Gmail here.&lt;br /&gt;
--- offlineimap/folder/Maildir.py	2008-08-13 20:55:48.000000000 +0200&lt;br /&gt;
+++ offlineimap/folder/Maildir-cygwin.py	2008-11-06 10:44:05.344202700 +0100&lt;br /&gt;
@@ -23,7 +23,6 @@&lt;br /&gt;
 import os.path, os, re, time, socket, md5&lt;br /&gt;
 &lt;br /&gt;
 uidmatchre = re.compile(&#039;,U=(\d+)&#039;)&lt;br /&gt;
-flagmatchre = re.compile(&#039;:.*2,([A-Z]+)&#039;)&lt;br /&gt;
 &lt;br /&gt;
 timeseq = 0&lt;br /&gt;
 lasttime = long(0)&lt;br /&gt;
@@ -54,6 +53,12 @@&lt;br /&gt;
         self.messagelist = None&lt;br /&gt;
         self.repository = repository&lt;br /&gt;
         self.accountname = accountname&lt;br /&gt;
+        self.filemode = {&lt;br /&gt;
+          &#039;binary&#039;: &#039;wb&#039;,&lt;br /&gt;
+          &#039;text&#039;: &#039;wt&#039;,&lt;br /&gt;
+        }[repository.getconf(&amp;quot;filemode&amp;quot;, &#039;text&#039;)]&lt;br /&gt;
+        self.suffixsep = repository.getconf(&amp;quot;suffixsep&amp;quot;,&#039;:&#039;)&lt;br /&gt;
+        self.flagmatchre = re.compile(&#039;%s.*2,([A-Z]+)&#039; % self.suffixsep)&lt;br /&gt;
         BaseFolder.__init__(self)&lt;br /&gt;
 &lt;br /&gt;
     def getaccountname(self):&lt;br /&gt;
@@ -102,7 +107,7 @@&lt;br /&gt;
                     nouidcounter -= 1&lt;br /&gt;
                 else:&lt;br /&gt;
                     uid = long(uidmatch.group(1))&lt;br /&gt;
-            flagmatch = flagmatchre.search(messagename)&lt;br /&gt;
+            flagmatch = self.flagmatchre.search(messagename)&lt;br /&gt;
             flags = []&lt;br /&gt;
             if flagmatch:&lt;br /&gt;
                 flags = [x for x in flagmatch.group(1)]&lt;br /&gt;
@@ -180,7 +185,7 @@&lt;br /&gt;
                 break&lt;br /&gt;
         tmpmessagename = messagename.split(&#039;,&#039;)[0]&lt;br /&gt;
         ui.debug(&#039;maildir&#039;, &#039;savemessage: using temporary name %s&#039; % tmpmessagename)&lt;br /&gt;
-        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wt&amp;quot;)&lt;br /&gt;
+        file = open(os.path.join(tmpdir, tmpmessagename), self.filemode)&lt;br /&gt;
         file.write(content)&lt;br /&gt;
 &lt;br /&gt;
         # Make sure the data hits the disk&lt;br /&gt;
@@ -226,11 +231,11 @@&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;cur&#039;)&lt;br /&gt;
         else:&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;new&#039;)&lt;br /&gt;
-        infostr = &#039;:&#039;&lt;br /&gt;
-        infomatch = re.search(&#039;(:.*)$&#039;, newname)&lt;br /&gt;
+        infostr = self.suffixsep&lt;br /&gt;
+        infomatch = re.search(&#039;(%s.*)$&#039; % self.suffixsep, newname)&lt;br /&gt;
         if infomatch:                   # If the info string is present..&lt;br /&gt;
             infostr = infomatch.group(1)&lt;br /&gt;
-            newname = newname.split(&#039;:&#039;)[0] # Strip off the info string.&lt;br /&gt;
+            newname = newname.split(self.suffixsep)[0] # Strip off the info string.&lt;br /&gt;
         infostr = re.sub(&#039;2,[A-Z]*&#039;, &#039;&#039;, infostr)&lt;br /&gt;
         flags.sort()&lt;br /&gt;
         infostr += &#039;2,&#039; + &#039;&#039;.join(flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np0 &amp;lt; offlineimap_6.0.3-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Install offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
&lt;br /&gt;
Configure offlineimap as described in [[Offlineimap]] and launch offlineimap. &#039;&#039;&#039;CAUTION:&#039;&#039;&#039; Add the NEW suffixsep and filemode options in the Maildir repository section of the configuration file.&lt;br /&gt;
&lt;br /&gt;
 $ offlineimap&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -1 -o -u Noninteractive.Basic&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -c /home/username/offlineimap.conf&lt;br /&gt;
&lt;br /&gt;
Here is a simple [{{#file:offlineimap.conf}} offlineimap configuration file].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
[general]&lt;br /&gt;
metadata = /home/username/.offlineimap&lt;br /&gt;
accounts = Test&lt;br /&gt;
maxsyncaccounts = 1&lt;br /&gt;
ui = Curses.Blinkenlights, TTY.TTYUI,&lt;br /&gt;
     Noninteractive.Basic, Noninteractive.Quiet&lt;br /&gt;
ignore-readonly = no&lt;br /&gt;
&lt;br /&gt;
[mbnames]&lt;br /&gt;
enabled = no&lt;br /&gt;
&lt;br /&gt;
[ui.Curses.Blinkenlights]&lt;br /&gt;
statuschar = .&lt;br /&gt;
&lt;br /&gt;
[Account Test]&lt;br /&gt;
localrepository = LocalExample&lt;br /&gt;
remoterepository = RemoteExample&lt;br /&gt;
&lt;br /&gt;
[Repository LocalExample]&lt;br /&gt;
type = Maildir&lt;br /&gt;
localfolders = /home/username/Maildir&lt;br /&gt;
sep = .&lt;br /&gt;
restoreatime = no&lt;br /&gt;
&lt;br /&gt;
suffixsep = !                    # &amp;lt;&amp;lt;&amp;lt; NEW&lt;br /&gt;
filemode = binary                # &amp;lt;&amp;lt;&amp;lt; NEW&lt;br /&gt;
&lt;br /&gt;
[Repository RemoteExample]&lt;br /&gt;
type = IMAP&lt;br /&gt;
remotehost = imapserver&lt;br /&gt;
ssl = no&lt;br /&gt;
remoteport = 143&lt;br /&gt;
remoteuser = username&lt;br /&gt;
remotepass = XXXXXX&lt;br /&gt;
maxconnections = 1&lt;br /&gt;
holdconnectionopen = no&lt;br /&gt;
nametrans = lambda foldername: re.sub(&#039;^INBOX\.*&#039;, &#039;.&#039;, foldername)&lt;br /&gt;
folderfilter = lambda foldername: not re.search(&#039;(SPAM$|Mairix)&#039;, foldername)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5289</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5289"/>
		<updated>2008-11-06T10:06:19Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Offlineimap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;br /&gt;
&lt;br /&gt;
=Offlineimap=&lt;br /&gt;
Requires python, so run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package python.&lt;br /&gt;
&lt;br /&gt;
Download offlineimap [http://software.complete.org/software/projects/list_files/offlineimap here]. I use [http://software.complete.org/software/versions/download/242?attachment_id=334 version 6.0.3]. Extract files in you favorite sandbox.&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz offlineimap_6.0.3.tar.gz&lt;br /&gt;
 $ cd offlineimap&lt;br /&gt;
&lt;br /&gt;
Apply the following [{{#file:offlineimap_6.0.3-cygwin.patch}} patch] to correct the following issues:&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Maildir#Windows_software Suffix separator] character colon (:) is not allowed in Windows. Courier-imap for cygwin is using (!)&lt;br /&gt;
* While used by courier-imap for cygwin Maildir mail files should not use CRLF, rather only LF. The issue appears only in mail with attachment, that is the raw message is not interpreted and displayed as it in the mail body (under Thunderbird).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- offlineimap.conf	2008-08-13 20:56:04.000000000 +0200&lt;br /&gt;
+++ offlineimap-cygwin.conf	2008-11-06 10:44:31.066750700 +0100&lt;br /&gt;
@@ -215,6 +215,19 @@&lt;br /&gt;
 &lt;br /&gt;
 restoreatime = no&lt;br /&gt;
 &lt;br /&gt;
+# Cygwin/Windows users may have issues with the Maildir mail filename&lt;br /&gt;
+# containing the suffix separator character (:). In this case, they&lt;br /&gt;
+# could change the suffix separator character to whatever required.&lt;br /&gt;
+# For example, Courier-IMAP for Cygwin is using (!)&lt;br /&gt;
+&lt;br /&gt;
+# suffixsep = !&lt;br /&gt;
+&lt;br /&gt;
+# Cygwin/Windows users may need to create Maildir mail filename in&lt;br /&gt;
+# binary mode. In this case, set the &#039;filemode&#039; to &#039;binary&#039;. Default is&lt;br /&gt;
+# &#039;text&#039;. Courier-IMAP for Cygwin works better with binary mode.&lt;br /&gt;
+&lt;br /&gt;
+# filemode = binary&lt;br /&gt;
+&lt;br /&gt;
 [Repository RemoteExample]&lt;br /&gt;
 &lt;br /&gt;
 # And this is the remote repository.  We only support IMAP or Gmail here.&lt;br /&gt;
--- offlineimap/folder/Maildir.py	2008-08-13 20:55:48.000000000 +0200&lt;br /&gt;
+++ offlineimap/folder/Maildir-cygwin.py	2008-11-06 10:44:05.344202700 +0100&lt;br /&gt;
@@ -23,7 +23,6 @@&lt;br /&gt;
 import os.path, os, re, time, socket, md5&lt;br /&gt;
 &lt;br /&gt;
 uidmatchre = re.compile(&#039;,U=(\d+)&#039;)&lt;br /&gt;
-flagmatchre = re.compile(&#039;:.*2,([A-Z]+)&#039;)&lt;br /&gt;
 &lt;br /&gt;
 timeseq = 0&lt;br /&gt;
 lasttime = long(0)&lt;br /&gt;
@@ -54,6 +53,12 @@&lt;br /&gt;
         self.messagelist = None&lt;br /&gt;
         self.repository = repository&lt;br /&gt;
         self.accountname = accountname&lt;br /&gt;
+        self.filemode = {&lt;br /&gt;
+          &#039;binary&#039;: &#039;wb&#039;,&lt;br /&gt;
+          &#039;text&#039;: &#039;wt&#039;,&lt;br /&gt;
+        }[repository.getconf(&amp;quot;filemode&amp;quot;, &#039;text&#039;)]&lt;br /&gt;
+        self.suffixsep = repository.getconf(&amp;quot;suffixsep&amp;quot;,&#039;:&#039;)&lt;br /&gt;
+        self.flagmatchre = re.compile(&#039;%s.*2,([A-Z]+)&#039; % self.suffixsep)&lt;br /&gt;
         BaseFolder.__init__(self)&lt;br /&gt;
 &lt;br /&gt;
     def getaccountname(self):&lt;br /&gt;
@@ -102,7 +107,7 @@&lt;br /&gt;
                     nouidcounter -= 1&lt;br /&gt;
                 else:&lt;br /&gt;
                     uid = long(uidmatch.group(1))&lt;br /&gt;
-            flagmatch = flagmatchre.search(messagename)&lt;br /&gt;
+            flagmatch = self.flagmatchre.search(messagename)&lt;br /&gt;
             flags = []&lt;br /&gt;
             if flagmatch:&lt;br /&gt;
                 flags = [x for x in flagmatch.group(1)]&lt;br /&gt;
@@ -180,7 +185,7 @@&lt;br /&gt;
                 break&lt;br /&gt;
         tmpmessagename = messagename.split(&#039;,&#039;)[0]&lt;br /&gt;
         ui.debug(&#039;maildir&#039;, &#039;savemessage: using temporary name %s&#039; % tmpmessagename)&lt;br /&gt;
-        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wt&amp;quot;)&lt;br /&gt;
+        file = open(os.path.join(tmpdir, tmpmessagename), self.filemode)&lt;br /&gt;
         file.write(content)&lt;br /&gt;
 &lt;br /&gt;
         # Make sure the data hits the disk&lt;br /&gt;
@@ -226,11 +231,11 @@&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;cur&#039;)&lt;br /&gt;
         else:&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;new&#039;)&lt;br /&gt;
-        infostr = &#039;:&#039;&lt;br /&gt;
-        infomatch = re.search(&#039;(:.*)$&#039;, newname)&lt;br /&gt;
+        infostr = self.suffixsep&lt;br /&gt;
+        infomatch = re.search(&#039;(%s.*)$&#039; % self.suffixsep, newname)&lt;br /&gt;
         if infomatch:                   # If the info string is present..&lt;br /&gt;
             infostr = infomatch.group(1)&lt;br /&gt;
-            newname = newname.split(&#039;:&#039;)[0] # Strip off the info string.&lt;br /&gt;
+            newname = newname.split(self.suffixsep)[0] # Strip off the info string.&lt;br /&gt;
         infostr = re.sub(&#039;2,[A-Z]*&#039;, &#039;&#039;, infostr)&lt;br /&gt;
         flags.sort()&lt;br /&gt;
         infostr += &#039;2,&#039; + &#039;&#039;.join(flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np0 &amp;lt; ../../offlineimap_6.0.3-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Install offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
&lt;br /&gt;
Configure offlineimap as described in [[Offlineimap]] and launch offlineimap. &#039;&#039;&#039;CAUTION:&#039;&#039;&#039; Add the NEW suffixsep and filemode options in the Maildir repository section of the configuration file.&lt;br /&gt;
&lt;br /&gt;
 $ offlineimap&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -1 -o -u Noninteractive.Basic&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -c /home/username/offlineimap.conf&lt;br /&gt;
&lt;br /&gt;
Here is a simple [{{#file:offlineimap.conf}} offlineimap configuration file].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
[general]&lt;br /&gt;
metadata = /home/username/.offlineimap&lt;br /&gt;
accounts = Test&lt;br /&gt;
maxsyncaccounts = 1&lt;br /&gt;
ui = Curses.Blinkenlights, TTY.TTYUI,&lt;br /&gt;
     Noninteractive.Basic, Noninteractive.Quiet&lt;br /&gt;
ignore-readonly = no&lt;br /&gt;
&lt;br /&gt;
[mbnames]&lt;br /&gt;
enabled = no&lt;br /&gt;
&lt;br /&gt;
[ui.Curses.Blinkenlights]&lt;br /&gt;
statuschar = .&lt;br /&gt;
&lt;br /&gt;
[Account Test]&lt;br /&gt;
localrepository = LocalExample&lt;br /&gt;
remoterepository = RemoteExample&lt;br /&gt;
&lt;br /&gt;
[Repository LocalExample]&lt;br /&gt;
type = Maildir&lt;br /&gt;
localfolders = /home/username/Maildir&lt;br /&gt;
sep = .&lt;br /&gt;
restoreatime = no&lt;br /&gt;
&lt;br /&gt;
suffixsep = !                    # &amp;lt;&amp;lt;&amp;lt; NEW&lt;br /&gt;
filemode = binary                # &amp;lt;&amp;lt;&amp;lt; NEW&lt;br /&gt;
&lt;br /&gt;
[Repository RemoteExample]&lt;br /&gt;
type = IMAP&lt;br /&gt;
remotehost = imapserver&lt;br /&gt;
ssl = no&lt;br /&gt;
remoteport = 143&lt;br /&gt;
remoteuser = username&lt;br /&gt;
remotepass = XXXXXX&lt;br /&gt;
maxconnections = 1&lt;br /&gt;
holdconnectionopen = no&lt;br /&gt;
nametrans = lambda foldername: re.sub(&#039;^INBOX\.*&#039;, &#039;.&#039;, foldername)&lt;br /&gt;
folderfilter = lambda foldername: not re.search(&#039;(SPAM$|Mairix)&#039;, foldername)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5281</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5281"/>
		<updated>2008-11-04T09:18:18Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Offlineimap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;br /&gt;
&lt;br /&gt;
=Offlineimap=&lt;br /&gt;
Requires python, so run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package python.&lt;br /&gt;
&lt;br /&gt;
Download offlineimap [http://software.complete.org/software/projects/list_files/offlineimap here]. I use [http://software.complete.org/software/versions/download/242?attachment_id=334 version 6.0.3]. Extract files in you favorite sandbox.&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz offlineimap_6.0.3.tar.gz&lt;br /&gt;
 $ cd offlineimap&lt;br /&gt;
&lt;br /&gt;
Apply the following [{{#file:offlineimap_6.0.3-cygwin.patch}} patch] to correct the following issues:&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Maildir#Windows_software Suffix separator character] (:) is not allowed in Windows. Courier-imap for cygwin is using (!)&lt;br /&gt;
* While used by courier-imap for cygwin Maildir mail files should not use CRLF, rather only LF. The issue appears only in mail with attachment, that is the raw message is not interpreted and displayed as it in the mail body (under Thunderbird).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- offlineimap/folder/Maildir.py	2008-11-01 20:49:30.843750000 +0100&lt;br /&gt;
+++ offlineimap/folder/Maildir-cygwin.py	2008-11-03 22:54:51.437500000 +0100&lt;br /&gt;
@@ -23,7 +23,7 @@&lt;br /&gt;
 import os.path, os, re, time, socket, md5&lt;br /&gt;
 &lt;br /&gt;
 uidmatchre = re.compile(&#039;,U=(\d+)&#039;)&lt;br /&gt;
-flagmatchre = re.compile(&#039;:.*2,([A-Z]+)&#039;)&lt;br /&gt;
+flagmatchre = re.compile(&#039;!.*2,([A-Z]+)&#039;)&lt;br /&gt;
 &lt;br /&gt;
 timeseq = 0&lt;br /&gt;
 lasttime = long(0)&lt;br /&gt;
@@ -180,7 +180,7 @@&lt;br /&gt;
                 break&lt;br /&gt;
         tmpmessagename = messagename.split(&#039;,&#039;)[0]&lt;br /&gt;
         ui.debug(&#039;maildir&#039;, &#039;savemessage: using temporary name %s&#039; % tmpmessagename)&lt;br /&gt;
-        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wt&amp;quot;)&lt;br /&gt;
+        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wb&amp;quot;)&lt;br /&gt;
         file.write(content)&lt;br /&gt;
 &lt;br /&gt;
         # Make sure the data hits the disk&lt;br /&gt;
@@ -226,11 +226,11 @@&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;cur&#039;)&lt;br /&gt;
         else:&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;new&#039;)&lt;br /&gt;
-        infostr = &#039;:&#039;&lt;br /&gt;
-        infomatch = re.search(&#039;(:.*)$&#039;, newname)&lt;br /&gt;
+        infostr = &#039;!&#039;&lt;br /&gt;
+        infomatch = re.search(&#039;(!.*)$&#039;, newname)&lt;br /&gt;
         if infomatch:                   # If the info string is present..&lt;br /&gt;
             infostr = infomatch.group(1)&lt;br /&gt;
-            newname = newname.split(&#039;:&#039;)[0] # Strip off the info string.&lt;br /&gt;
+            newname = newname.split(&#039;!&#039;)[0] # Strip off the info string.&lt;br /&gt;
         infostr = re.sub(&#039;2,[A-Z]*&#039;, &#039;&#039;, infostr)&lt;br /&gt;
         flags.sort()&lt;br /&gt;
         infostr += &#039;2,&#039; + &#039;&#039;.join(flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ cd offlineimap/folder&lt;br /&gt;
 $ patch -Np2 &amp;lt; ../../offlineimap_6.0.3-cygwin.patch&lt;br /&gt;
 $ cd ../..&lt;br /&gt;
&lt;br /&gt;
Install offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
&lt;br /&gt;
Configure offlineimap as described in [[Offlineimap]] and launch offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ offlineimap&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -1 -o -u Noninteractive.Basic&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -c /home/username/offlineimap.conf&lt;br /&gt;
&lt;br /&gt;
Here is a simple [{{#file:offlineimap.conf}} offlineimap configuration file].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
[general]&lt;br /&gt;
metadata = /home/username/.offlineimap&lt;br /&gt;
accounts = Test&lt;br /&gt;
maxsyncaccounts = 1&lt;br /&gt;
ui = Curses.Blinkenlights, TTY.TTYUI,&lt;br /&gt;
     Noninteractive.Basic, Noninteractive.Quiet&lt;br /&gt;
ignore-readonly = no&lt;br /&gt;
&lt;br /&gt;
[mbnames]&lt;br /&gt;
enabled = no&lt;br /&gt;
&lt;br /&gt;
[ui.Curses.Blinkenlights]&lt;br /&gt;
statuschar = .&lt;br /&gt;
&lt;br /&gt;
[Account Test]&lt;br /&gt;
localrepository = LocalExample&lt;br /&gt;
remoterepository = RemoteExample&lt;br /&gt;
&lt;br /&gt;
[Repository LocalExample]&lt;br /&gt;
type = Maildir&lt;br /&gt;
localfolders = /home/username/Maildir&lt;br /&gt;
sep = .&lt;br /&gt;
restoreatime = no&lt;br /&gt;
&lt;br /&gt;
[Repository RemoteExample]&lt;br /&gt;
type = IMAP&lt;br /&gt;
remotehost = imapserver&lt;br /&gt;
ssl = no&lt;br /&gt;
remoteport = 143&lt;br /&gt;
remoteuser = username&lt;br /&gt;
remotepass = XXXXXX&lt;br /&gt;
maxconnections = 1&lt;br /&gt;
holdconnectionopen = no&lt;br /&gt;
nametrans = lambda foldername: re.sub(&#039;^INBOX\.*&#039;, &#039;.&#039;, foldername)&lt;br /&gt;
folderfilter = lambda foldername: not re.search(&#039;(SPAM$|Mairix)&#039;, foldername)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5280</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5280"/>
		<updated>2008-11-04T08:57:18Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Offlineimap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;br /&gt;
&lt;br /&gt;
=Offlineimap=&lt;br /&gt;
Requires python, so run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package python.&lt;br /&gt;
&lt;br /&gt;
Download offlineimap [http://software.complete.org/software/projects/list_files/offlineimap here]. I use [http://software.complete.org/software/versions/download/242?attachment_id=334 version 6.0.3]. Extract files in you favorite sandbox.&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz offlineimap_6.0.3.tar.gz&lt;br /&gt;
 $ cd offlineimap&lt;br /&gt;
&lt;br /&gt;
Apply the following [{{#file:offlineimap_6.0.3-cygwin.patch}} patch] to correct the following issues:&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Maildir#Windows_software Suffix separator character] (:) is not allowed in Windows. Courier-imap for cygwin is using (!)&lt;br /&gt;
* While used by courier-imap for cygwin Maildir mail files should not use CRLF, rather only LF. The issue appears only in mail with attachment, that is the raw message is not interpreted and displayed as it in the mail body (under Thunderbird).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- offlineimap/folder/Maildir.py	2008-11-01 20:49:30.843750000 +0100&lt;br /&gt;
+++ offlineimap/folder/Maildir-cygwin.py	2008-11-03 22:54:51.437500000 +0100&lt;br /&gt;
@@ -23,7 +23,7 @@&lt;br /&gt;
 import os.path, os, re, time, socket, md5&lt;br /&gt;
 &lt;br /&gt;
 uidmatchre = re.compile(&#039;,U=(\d+)&#039;)&lt;br /&gt;
-flagmatchre = re.compile(&#039;:.*2,([A-Z]+)&#039;)&lt;br /&gt;
+flagmatchre = re.compile(&#039;!.*2,([A-Z]+)&#039;)&lt;br /&gt;
 &lt;br /&gt;
 timeseq = 0&lt;br /&gt;
 lasttime = long(0)&lt;br /&gt;
@@ -180,7 +180,7 @@&lt;br /&gt;
                 break&lt;br /&gt;
         tmpmessagename = messagename.split(&#039;,&#039;)[0]&lt;br /&gt;
         ui.debug(&#039;maildir&#039;, &#039;savemessage: using temporary name %s&#039; % tmpmessagename)&lt;br /&gt;
-        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wt&amp;quot;)&lt;br /&gt;
+        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wb&amp;quot;)&lt;br /&gt;
         file.write(content)&lt;br /&gt;
 &lt;br /&gt;
         # Make sure the data hits the disk&lt;br /&gt;
@@ -226,11 +226,11 @@&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;cur&#039;)&lt;br /&gt;
         else:&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;new&#039;)&lt;br /&gt;
-        infostr = &#039;:&#039;&lt;br /&gt;
-        infomatch = re.search(&#039;(:.*)$&#039;, newname)&lt;br /&gt;
+        infostr = &#039;!&#039;&lt;br /&gt;
+        infomatch = re.search(&#039;(!.*)$&#039;, newname)&lt;br /&gt;
         if infomatch:                   # If the info string is present..&lt;br /&gt;
             infostr = infomatch.group(1)&lt;br /&gt;
-            newname = newname.split(&#039;:&#039;)[0] # Strip off the info string.&lt;br /&gt;
+            newname = newname.split(&#039;!&#039;)[0] # Strip off the info string.&lt;br /&gt;
         infostr = re.sub(&#039;2,[A-Z]*&#039;, &#039;&#039;, infostr)&lt;br /&gt;
         flags.sort()&lt;br /&gt;
         infostr += &#039;2,&#039; + &#039;&#039;.join(flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ cd offlineimap/folder&lt;br /&gt;
 $ patch -Np2 &amp;lt; ../../offlineimap-cygwin_6.0.3.patch&lt;br /&gt;
 $ cd ../..&lt;br /&gt;
&lt;br /&gt;
Install offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
&lt;br /&gt;
Configure offlineimap as described in [[Offlineimap]] and launch offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ offlineimap&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -1 -o -u Noninteractive.Basic&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -c /home/username/offlineimap.conf&lt;br /&gt;
&lt;br /&gt;
Here is a simple [{{#file:offlineimap.conf}} offlineimap configuration file].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
[general]&lt;br /&gt;
metadata = /home/username/.offlineimap&lt;br /&gt;
accounts = Test&lt;br /&gt;
maxsyncaccounts = 1&lt;br /&gt;
ui = Curses.Blinkenlights, TTY.TTYUI,&lt;br /&gt;
     Noninteractive.Basic, Noninteractive.Quiet&lt;br /&gt;
ignore-readonly = no&lt;br /&gt;
&lt;br /&gt;
[mbnames]&lt;br /&gt;
enabled = no&lt;br /&gt;
&lt;br /&gt;
[ui.Curses.Blinkenlights]&lt;br /&gt;
statuschar = .&lt;br /&gt;
&lt;br /&gt;
[Account Test]&lt;br /&gt;
localrepository = LocalExample&lt;br /&gt;
remoterepository = RemoteExample&lt;br /&gt;
&lt;br /&gt;
[Repository LocalExample]&lt;br /&gt;
type = Maildir&lt;br /&gt;
localfolders = /home/username/Maildir&lt;br /&gt;
sep = .&lt;br /&gt;
restoreatime = no&lt;br /&gt;
&lt;br /&gt;
[Repository RemoteExample]&lt;br /&gt;
type = IMAP&lt;br /&gt;
remotehost = imapserver&lt;br /&gt;
ssl = no&lt;br /&gt;
remoteport = 143&lt;br /&gt;
remoteuser = username&lt;br /&gt;
remotepass = XXXXXX&lt;br /&gt;
maxconnections = 1&lt;br /&gt;
holdconnectionopen = no&lt;br /&gt;
nametrans = lambda foldername: re.sub(&#039;^INBOX\.*&#039;, &#039;.&#039;, foldername)&lt;br /&gt;
folderfilter = lambda foldername: not re.search(&#039;(SPAM$|Mairix)&#039;, foldername)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5279</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5279"/>
		<updated>2008-11-04T08:55:30Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Offlineimap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;br /&gt;
&lt;br /&gt;
=Offlineimap=&lt;br /&gt;
Requires python, so run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package python.&lt;br /&gt;
&lt;br /&gt;
Download offlineimap [http://software.complete.org/software/projects/list_files/offlineimap here]. I use [http://software.complete.org/software/versions/download/242?attachment_id=334 version 6.0.3]. Extract files in you favorite sandbox.&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz offlineimap_6.0.3.tar.gz&lt;br /&gt;
 $ cd offlineimap&lt;br /&gt;
&lt;br /&gt;
Apply the following [{{#file:offlineimap_6.0.3-cygwin.patch}} patch] to correct the following issues:&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Maildir#Windows_software Suffix separator character] (:) is not allowed in Windows. Courier-imap for cygwin is using (!)&lt;br /&gt;
* While used by courier-imap for cygwin Maildir mail files should not use CRLF, rather only LF. The issue appears only in mail with attachment, that is the raw message is not interpreted and displayed as it in the mail body (under Thunderbird).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- offlineimap/folder/Maildir.py	2008-11-01 20:49:30.843750000 +0100&lt;br /&gt;
+++ offlineimap/folder/Maildir-cygwin.py	2008-11-03 22:54:51.437500000 +0100&lt;br /&gt;
@@ -23,7 +23,7 @@&lt;br /&gt;
 import os.path, os, re, time, socket, md5&lt;br /&gt;
 &lt;br /&gt;
 uidmatchre = re.compile(&#039;,U=(\d+)&#039;)&lt;br /&gt;
-flagmatchre = re.compile(&#039;:.*2,([A-Z]+)&#039;)&lt;br /&gt;
+flagmatchre = re.compile(&#039;!.*2,([A-Z]+)&#039;)&lt;br /&gt;
 &lt;br /&gt;
 timeseq = 0&lt;br /&gt;
 lasttime = long(0)&lt;br /&gt;
@@ -180,7 +180,7 @@&lt;br /&gt;
                 break&lt;br /&gt;
         tmpmessagename = messagename.split(&#039;,&#039;)[0]&lt;br /&gt;
         ui.debug(&#039;maildir&#039;, &#039;savemessage: using temporary name %s&#039; % tmpmessagename)&lt;br /&gt;
-        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wt&amp;quot;)&lt;br /&gt;
+        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wb&amp;quot;)&lt;br /&gt;
         file.write(content)&lt;br /&gt;
 &lt;br /&gt;
         # Make sure the data hits the disk&lt;br /&gt;
@@ -226,11 +226,11 @@&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;cur&#039;)&lt;br /&gt;
         else:&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;new&#039;)&lt;br /&gt;
-        infostr = &#039;:&#039;&lt;br /&gt;
-        infomatch = re.search(&#039;(:.*)$&#039;, newname)&lt;br /&gt;
+        infostr = &#039;!&#039;&lt;br /&gt;
+        infomatch = re.search(&#039;(!.*)$&#039;, newname)&lt;br /&gt;
         if infomatch:                   # If the info string is present..&lt;br /&gt;
             infostr = infomatch.group(1)&lt;br /&gt;
-            newname = newname.split(&#039;:&#039;)[0] # Strip off the info string.&lt;br /&gt;
+            newname = newname.split(&#039;!&#039;)[0] # Strip off the info string.&lt;br /&gt;
         infostr = re.sub(&#039;2,[A-Z]*&#039;, &#039;&#039;, infostr)&lt;br /&gt;
         flags.sort()&lt;br /&gt;
         infostr += &#039;2,&#039; + &#039;&#039;.join(flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ cd offlineimap/folder&lt;br /&gt;
 $ patch -Np2 &amp;lt; ../../offlineimap-cygwin_6.0.3.patch&lt;br /&gt;
 $ cd ../..&lt;br /&gt;
&lt;br /&gt;
Install offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
&lt;br /&gt;
Configure offlineimap as described in [[Offlineimap]] and launch offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ offlineimap&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -1 -o -u Noninteractive.Basic&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -c /home/username/offlineimap.conf&lt;br /&gt;
&lt;br /&gt;
Here is a simple [{{#file:offlineimap.conf}} offlineimap configuration file].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=conf&amp;gt;&lt;br /&gt;
[general]&lt;br /&gt;
metadata = /home/username/.offlineimap&lt;br /&gt;
accounts = Test&lt;br /&gt;
maxsyncaccounts = 1&lt;br /&gt;
ui = Curses.Blinkenlights, TTY.TTYUI,&lt;br /&gt;
     Noninteractive.Basic, Noninteractive.Quiet&lt;br /&gt;
ignore-readonly = no&lt;br /&gt;
[mbnames]&lt;br /&gt;
enabled = no&lt;br /&gt;
[ui.Curses.Blinkenlights]&lt;br /&gt;
statuschar = .&lt;br /&gt;
[Account Test]&lt;br /&gt;
localrepository = LocalExample&lt;br /&gt;
remoterepository = RemoteExample&lt;br /&gt;
[Repository LocalExample]&lt;br /&gt;
type = Maildir&lt;br /&gt;
localfolders = /home/username/Maildir&lt;br /&gt;
sep = .&lt;br /&gt;
restoreatime = no&lt;br /&gt;
[Repository RemoteExample]&lt;br /&gt;
type = IMAP&lt;br /&gt;
remotehost = imapserver&lt;br /&gt;
ssl = no&lt;br /&gt;
remoteport = 143&lt;br /&gt;
remoteuser = username&lt;br /&gt;
remotepass = XXXXXX&lt;br /&gt;
maxconnections = 1&lt;br /&gt;
holdconnectionopen = no&lt;br /&gt;
nametrans = lambda foldername: re.sub(&#039;^INBOX\.*&#039;, &#039;.&#039;, foldername)&lt;br /&gt;
folderfilter = lambda foldername: not re.search(&#039;(SPAM$|Mairix)&#039;, foldername)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5278</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5278"/>
		<updated>2008-11-04T08:50:27Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Offlineimap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;br /&gt;
&lt;br /&gt;
=Offlineimap=&lt;br /&gt;
Requires python, so run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package python.&lt;br /&gt;
&lt;br /&gt;
Download offlineimap [http://software.complete.org/software/projects/list_files/offlineimap here]. I use [http://software.complete.org/software/versions/download/242?attachment_id=334 version 6.0.3]. Extract files in you favorite sandbox.&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz offlineimap_6.0.3.tar.gz&lt;br /&gt;
 $ cd offlineimap&lt;br /&gt;
&lt;br /&gt;
Apply the following [{{#file:offlineimap_6.0.3-cygwin.patch}} patch] to correct the following issues:&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Maildir#Windows_software Suffix separator character] (:) is not allowed in Windows. Courier-imap for cygwin is using (!)&lt;br /&gt;
* While used by courier-imap for cygwin Maildir mail files should not use CRLF, rather only LF. The issue appears only in mail with attachment, that is the raw message is not interpreted and displayed as it in the mail body (under Thunderbird).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- offlineimap/folder/Maildir.py	2008-11-01 20:49:30.843750000 +0100&lt;br /&gt;
+++ offlineimap/folder/Maildir-cygwin.py	2008-11-03 22:54:51.437500000 +0100&lt;br /&gt;
@@ -23,7 +23,7 @@&lt;br /&gt;
 import os.path, os, re, time, socket, md5&lt;br /&gt;
 &lt;br /&gt;
 uidmatchre = re.compile(&#039;,U=(\d+)&#039;)&lt;br /&gt;
-flagmatchre = re.compile(&#039;:.*2,([A-Z]+)&#039;)&lt;br /&gt;
+flagmatchre = re.compile(&#039;!.*2,([A-Z]+)&#039;)&lt;br /&gt;
 &lt;br /&gt;
 timeseq = 0&lt;br /&gt;
 lasttime = long(0)&lt;br /&gt;
@@ -180,7 +180,7 @@&lt;br /&gt;
                 break&lt;br /&gt;
         tmpmessagename = messagename.split(&#039;,&#039;)[0]&lt;br /&gt;
         ui.debug(&#039;maildir&#039;, &#039;savemessage: using temporary name %s&#039; % tmpmessagename)&lt;br /&gt;
-        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wt&amp;quot;)&lt;br /&gt;
+        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wb&amp;quot;)&lt;br /&gt;
         file.write(content)&lt;br /&gt;
 &lt;br /&gt;
         # Make sure the data hits the disk&lt;br /&gt;
@@ -226,11 +226,11 @@&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;cur&#039;)&lt;br /&gt;
         else:&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;new&#039;)&lt;br /&gt;
-        infostr = &#039;:&#039;&lt;br /&gt;
-        infomatch = re.search(&#039;(:.*)$&#039;, newname)&lt;br /&gt;
+        infostr = &#039;!&#039;&lt;br /&gt;
+        infomatch = re.search(&#039;(!.*)$&#039;, newname)&lt;br /&gt;
         if infomatch:                   # If the info string is present..&lt;br /&gt;
             infostr = infomatch.group(1)&lt;br /&gt;
-            newname = newname.split(&#039;:&#039;)[0] # Strip off the info string.&lt;br /&gt;
+            newname = newname.split(&#039;!&#039;)[0] # Strip off the info string.&lt;br /&gt;
         infostr = re.sub(&#039;2,[A-Z]*&#039;, &#039;&#039;, infostr)&lt;br /&gt;
         flags.sort()&lt;br /&gt;
         infostr += &#039;2,&#039; + &#039;&#039;.join(flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ cd offlineimap/folder&lt;br /&gt;
 $ patch -Np2 &amp;lt; ../../offlineimap-cygwin_6.0.3.patch&lt;br /&gt;
 $ cd ../..&lt;br /&gt;
&lt;br /&gt;
Install offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
&lt;br /&gt;
Configure offlineimap as described in [[Offlineimap]] and launch offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ offlineimap&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -1 -o -u Noninteractive.Basic&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -c /home/username/offlineimap.conf&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5277</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5277"/>
		<updated>2008-11-04T08:47:21Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Offlineimap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;br /&gt;
&lt;br /&gt;
=Offlineimap=&lt;br /&gt;
Requires python, so run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package python.&lt;br /&gt;
&lt;br /&gt;
Download offlineimap [http://software.complete.org/software/projects/list_files/offlineimap here]. I use [http://software.complete.org/software/versions/download/242?attachment_id=334 version 6.0.3]. Extract files in you favorite sandbox.&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz offlineimap_6.0.3.tar.gz&lt;br /&gt;
 $ cd offlineimap&lt;br /&gt;
&lt;br /&gt;
Apply the following [{{#file:offlineimap_6.0.3-cygwin.patch}} patch] to correct the following issues:&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Maildir#Windows_software Suffix separator character] (:) is not allowed in Windows. Courier-imap for cygwin is using (!)&lt;br /&gt;
* While used by courier-imap for cygwin Maildir mail files should not use CRLF, rather only LF. The issue appears only in mail with attachment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- offlineimap/folder/Maildir.py	2008-11-01 20:49:30.843750000 +0100&lt;br /&gt;
+++ offlineimap/folder/Maildir-cygwin.py	2008-11-03 22:54:51.437500000 +0100&lt;br /&gt;
@@ -23,7 +23,7 @@&lt;br /&gt;
 import os.path, os, re, time, socket, md5&lt;br /&gt;
 &lt;br /&gt;
 uidmatchre = re.compile(&#039;,U=(\d+)&#039;)&lt;br /&gt;
-flagmatchre = re.compile(&#039;:.*2,([A-Z]+)&#039;)&lt;br /&gt;
+flagmatchre = re.compile(&#039;!.*2,([A-Z]+)&#039;)&lt;br /&gt;
 &lt;br /&gt;
 timeseq = 0&lt;br /&gt;
 lasttime = long(0)&lt;br /&gt;
@@ -180,7 +180,7 @@&lt;br /&gt;
                 break&lt;br /&gt;
         tmpmessagename = messagename.split(&#039;,&#039;)[0]&lt;br /&gt;
         ui.debug(&#039;maildir&#039;, &#039;savemessage: using temporary name %s&#039; % tmpmessagename)&lt;br /&gt;
-        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wt&amp;quot;)&lt;br /&gt;
+        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wb&amp;quot;)&lt;br /&gt;
         file.write(content)&lt;br /&gt;
 &lt;br /&gt;
         # Make sure the data hits the disk&lt;br /&gt;
@@ -226,11 +226,11 @@&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;cur&#039;)&lt;br /&gt;
         else:&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;new&#039;)&lt;br /&gt;
-        infostr = &#039;:&#039;&lt;br /&gt;
-        infomatch = re.search(&#039;(:.*)$&#039;, newname)&lt;br /&gt;
+        infostr = &#039;!&#039;&lt;br /&gt;
+        infomatch = re.search(&#039;(!.*)$&#039;, newname)&lt;br /&gt;
         if infomatch:                   # If the info string is present..&lt;br /&gt;
             infostr = infomatch.group(1)&lt;br /&gt;
-            newname = newname.split(&#039;:&#039;)[0] # Strip off the info string.&lt;br /&gt;
+            newname = newname.split(&#039;!&#039;)[0] # Strip off the info string.&lt;br /&gt;
         infostr = re.sub(&#039;2,[A-Z]*&#039;, &#039;&#039;, infostr)&lt;br /&gt;
         flags.sort()&lt;br /&gt;
         infostr += &#039;2,&#039; + &#039;&#039;.join(flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ cd offlineimap/folder&lt;br /&gt;
 $ patch -Np2 &amp;lt; ../../offlineimap-cygwin_6.0.3.patch&lt;br /&gt;
 $ cd ../..&lt;br /&gt;
&lt;br /&gt;
Install offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
&lt;br /&gt;
Configure offlineimap as described in [[Offlineimap]] and launch offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ offlineimap&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -1 -o -u Noninteractive.Basic&lt;br /&gt;
 or&lt;br /&gt;
 $ offlineimap -c /home/username/offlineimap.conf&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5276</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5276"/>
		<updated>2008-11-04T08:45:29Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Offlineimap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;br /&gt;
&lt;br /&gt;
=Offlineimap=&lt;br /&gt;
Requires python, so run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package python.&lt;br /&gt;
&lt;br /&gt;
Download offlineimap [http://software.complete.org/software/projects/list_files/offlineimap here]. I use [http://software.complete.org/software/versions/download/242?attachment_id=334 version 6.0.3]. Extract files in you favorite sandbox.&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz offlineimap_6.0.3.tar.gz&lt;br /&gt;
 $ cd offlineimap&lt;br /&gt;
&lt;br /&gt;
Apply the following [{{#file:offlineimap_6.0.3-cygwin.patch}} patch] to correct the following issues:&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Maildir#Windows_software Suffix separator character] (:) is not allowed in Windows. Courier-imap for cygwin is using (!)&lt;br /&gt;
* While used by courier-imap for cygwin Maildir mail files should not use CRLF, rather only LF. The issue appears only in mail with attachment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- offlineimap/folder/Maildir.py	2008-11-01 20:49:30.843750000 +0100&lt;br /&gt;
+++ offlineimap/folder/Maildir-cygwin.py	2008-11-03 22:54:51.437500000 +0100&lt;br /&gt;
@@ -23,7 +23,7 @@&lt;br /&gt;
 import os.path, os, re, time, socket, md5&lt;br /&gt;
 &lt;br /&gt;
 uidmatchre = re.compile(&#039;,U=(\d+)&#039;)&lt;br /&gt;
-flagmatchre = re.compile(&#039;:.*2,([A-Z]+)&#039;)&lt;br /&gt;
+flagmatchre = re.compile(&#039;!.*2,([A-Z]+)&#039;)&lt;br /&gt;
 &lt;br /&gt;
 timeseq = 0&lt;br /&gt;
 lasttime = long(0)&lt;br /&gt;
@@ -180,7 +180,7 @@&lt;br /&gt;
                 break&lt;br /&gt;
         tmpmessagename = messagename.split(&#039;,&#039;)[0]&lt;br /&gt;
         ui.debug(&#039;maildir&#039;, &#039;savemessage: using temporary name %s&#039; % tmpmessagename)&lt;br /&gt;
-        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wt&amp;quot;)&lt;br /&gt;
+        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wb&amp;quot;)&lt;br /&gt;
         file.write(content)&lt;br /&gt;
 &lt;br /&gt;
         # Make sure the data hits the disk&lt;br /&gt;
@@ -226,11 +226,11 @@&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;cur&#039;)&lt;br /&gt;
         else:&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;new&#039;)&lt;br /&gt;
-        infostr = &#039;:&#039;&lt;br /&gt;
-        infomatch = re.search(&#039;(:.*)$&#039;, newname)&lt;br /&gt;
+        infostr = &#039;!&#039;&lt;br /&gt;
+        infomatch = re.search(&#039;(!.*)$&#039;, newname)&lt;br /&gt;
         if infomatch:                   # If the info string is present..&lt;br /&gt;
             infostr = infomatch.group(1)&lt;br /&gt;
-            newname = newname.split(&#039;:&#039;)[0] # Strip off the info string.&lt;br /&gt;
+            newname = newname.split(&#039;!&#039;)[0] # Strip off the info string.&lt;br /&gt;
         infostr = re.sub(&#039;2,[A-Z]*&#039;, &#039;&#039;, infostr)&lt;br /&gt;
         flags.sort()&lt;br /&gt;
         infostr += &#039;2,&#039; + &#039;&#039;.join(flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ cd offlineimap/folder&lt;br /&gt;
 $ patch -Np2 &amp;lt; ../../offlineimap-cygwin_6.0.3.patch&lt;br /&gt;
 $ cd ../..&lt;br /&gt;
&lt;br /&gt;
Install offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
&lt;br /&gt;
Configure offlineimap as described in [[Offlineimap]]&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5275</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5275"/>
		<updated>2008-11-04T08:42:29Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Mairix - index and search mail folders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;br /&gt;
&lt;br /&gt;
=Offlineimap=&lt;br /&gt;
Requires python, so run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package python.&lt;br /&gt;
&lt;br /&gt;
Download offlineimap [http://software.complete.org/software/projects/list_files/offlineimap here]. I use [http://software.complete.org/software/versions/download/242?attachment_id=334 version 6.0.3]. Extract files in you favorite sandbox.&lt;br /&gt;
&lt;br /&gt;
 $ tar xvfz offlineimap_6.0.3.tar.gz&lt;br /&gt;
 $ cd offlineimap&lt;br /&gt;
&lt;br /&gt;
Apply the following patch to correct the following issues:&lt;br /&gt;
&lt;br /&gt;
* Suffix separator character (:) is not allowed in Windows. Courier-imap for cygwin is using (!)&lt;br /&gt;
* While used by courier-imap for cygwin Maildir mail files should not use CRLF, rather only LF. The issue appears only in mail with attachment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- offlineimap/folder/Maildir.py	2008-11-01 20:49:30.843750000 +0100&lt;br /&gt;
+++ offlineimap/folder/Maildir-cygwin.py	2008-11-03 22:54:51.437500000 +0100&lt;br /&gt;
@@ -23,7 +23,7 @@&lt;br /&gt;
 import os.path, os, re, time, socket, md5&lt;br /&gt;
 &lt;br /&gt;
 uidmatchre = re.compile(&#039;,U=(\d+)&#039;)&lt;br /&gt;
-flagmatchre = re.compile(&#039;:.*2,([A-Z]+)&#039;)&lt;br /&gt;
+flagmatchre = re.compile(&#039;!.*2,([A-Z]+)&#039;)&lt;br /&gt;
 &lt;br /&gt;
 timeseq = 0&lt;br /&gt;
 lasttime = long(0)&lt;br /&gt;
@@ -180,7 +180,7 @@&lt;br /&gt;
                 break&lt;br /&gt;
         tmpmessagename = messagename.split(&#039;,&#039;)[0]&lt;br /&gt;
         ui.debug(&#039;maildir&#039;, &#039;savemessage: using temporary name %s&#039; % tmpmessagename)&lt;br /&gt;
-        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wt&amp;quot;)&lt;br /&gt;
+        file = open(os.path.join(tmpdir, tmpmessagename), &amp;quot;wb&amp;quot;)&lt;br /&gt;
         file.write(content)&lt;br /&gt;
 &lt;br /&gt;
         # Make sure the data hits the disk&lt;br /&gt;
@@ -226,11 +226,11 @@&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;cur&#039;)&lt;br /&gt;
         else:&lt;br /&gt;
             newpath = os.path.join(self.getfullname(), &#039;new&#039;)&lt;br /&gt;
-        infostr = &#039;:&#039;&lt;br /&gt;
-        infomatch = re.search(&#039;(:.*)$&#039;, newname)&lt;br /&gt;
+        infostr = &#039;!&#039;&lt;br /&gt;
+        infomatch = re.search(&#039;(!.*)$&#039;, newname)&lt;br /&gt;
         if infomatch:                   # If the info string is present..&lt;br /&gt;
             infostr = infomatch.group(1)&lt;br /&gt;
-            newname = newname.split(&#039;:&#039;)[0] # Strip off the info string.&lt;br /&gt;
+            newname = newname.split(&#039;!&#039;)[0] # Strip off the info string.&lt;br /&gt;
         infostr = re.sub(&#039;2,[A-Z]*&#039;, &#039;&#039;, infostr)&lt;br /&gt;
         flags.sort()&lt;br /&gt;
         infostr += &#039;2,&#039; + &#039;&#039;.join(flags)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ cd offlineimap/folders&lt;br /&gt;
 $ patch -Np1 &amp;lt; ../../offlineimap-cygwin.patch&lt;br /&gt;
 $ cd ../..&lt;br /&gt;
&lt;br /&gt;
Install offlineimap&lt;br /&gt;
&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
&lt;br /&gt;
Configure offlineimap&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5273</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5273"/>
		<updated>2008-11-01T16:08:38Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Mairix - index and search mail folders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $ mairix&lt;br /&gt;
 and&lt;br /&gt;
 $ mairix --fast-index  # on daily base&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5272</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5272"/>
		<updated>2008-11-01T16:05:30Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Mairix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix - index and search mail folders=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $&amp;gt; mairix&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5271</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5271"/>
		<updated>2008-11-01T16:04:41Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix=&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the package mairix.&lt;br /&gt;
&lt;br /&gt;
Create the configuration file in your home directory: ~/.mairixrc&lt;br /&gt;
&lt;br /&gt;
 base=/home/username&lt;br /&gt;
 maildir=Maildir...&lt;br /&gt;
 omit=Maildir/.Mairix**&lt;br /&gt;
 mfolder=Maildir/.Mairix&lt;br /&gt;
 database=/home/username/.mairix_database&lt;br /&gt;
&lt;br /&gt;
The create the mairix index&lt;br /&gt;
&lt;br /&gt;
 $&amp;gt; mairix&lt;br /&gt;
&lt;br /&gt;
See [[Mail_Tips]] for additional details.&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5270</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5270"/>
		<updated>2008-11-01T15:56:16Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Maildir */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;br /&gt;
&lt;br /&gt;
=Mairix=&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5269</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5269"/>
		<updated>2008-11-01T09:44:53Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Outlook&amp;diff=5268</id>
		<title>Outlook</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Outlook&amp;diff=5268"/>
		<updated>2008-11-01T09:41:42Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Installing a local IMAP server on Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A page about Outlook on this wiki? Sounds weird isn&#039;t it?&lt;br /&gt;
&amp;lt;br&amp;gt;Well, blame my employer.&lt;br /&gt;
&lt;br /&gt;
We migrated from Lotus Notes, with crappy hacked outdated client so Outlook is still better but...&lt;br /&gt;
&amp;lt;br&amp;gt;At least under Lotus Notes it was possible to add an IMAP account (BTW Lotus Notes crashed quite often when talking IMAP...)&lt;br /&gt;
&amp;lt;br&amp;gt;Here: Tools-&amp;gt;Account Settings-&amp;gt;&#039;&#039;This feature has been disabled by your system administrator&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Microsoft Office 2007 Resource Kit (official documentation from Microsoft)&lt;br /&gt;
** [http://technet.microsoft.com/en-gb/library/cc178979.aspx Documentation page]&lt;br /&gt;
*** [http://go.microsoft.com/fwlink/?LinkId=85671 Security for the 2007 Office release]&lt;br /&gt;
*** [http://go.microsoft.com/fwlink/?LinkID=94264 Group Policy overview for the 2007 Office release]&lt;br /&gt;
** [http://go.microsoft.com/fwlink/?LinkId=78161 Administrative template (ADM,ADMX,...) files]&lt;br /&gt;
*** Use [http://www.7-zip.org/ 7-zip] to decompress this file without installing it. Don&#039;t miss the summary excel sheet inside.&lt;br /&gt;
* &#039;&#039;Configuring Microsoft Outlook 2003&#039;&#039;, By Sue Mosher, Robert Sparnaaij, Charlie Pulfer, David Hooker.&lt;br /&gt;
** Excellent book for administering Outlook 2003. Content can be browsed/searched on [http://books.google.com/books?id=v8oZNEByTR0C Google Books].&lt;br /&gt;
* Excellent 3rd party page on Outlook policy: http://www.howto-outlook.com/howto/policies.htm&lt;br /&gt;
* Folder with interesting policy settings on Outlook [http://theether.net/download/Microsoft/Office/2007/].&lt;br /&gt;
&lt;br /&gt;
== Unlocking ==&lt;br /&gt;
&lt;br /&gt;
===Main registry keys===&lt;br /&gt;
Apparently important registry keys are under:&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook&lt;br /&gt;
Some tips [http://www.hotline-pc.org/outlook.htm here] (french)&lt;br /&gt;
&lt;br /&gt;
===IMAP settings===&lt;br /&gt;
&lt;br /&gt;
We can remove the admin barrier on account management:&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Setup\ModifyAccounts&lt;br /&gt;
 =0&lt;br /&gt;
&lt;br /&gt;
Another way without modifying the Registry is to use the import feature:&lt;br /&gt;
&amp;lt;br&amp;gt;If e.g. Outlook Express client is also present on the Windows machine&lt;br /&gt;
* In Outlook Express:&lt;br /&gt;
** Wizard -&amp;gt; typed my IMAP&amp;amp;SMTP settings&lt;br /&gt;
* In Outlook:&lt;br /&gt;
** File -&amp;gt; Import and Export... -&amp;gt; Import Internet Mail Account Settings -&amp;gt; Microsoft Outlook Express or Microsoft Windows Mail -&amp;gt; Wizard allowing to edit the imported settings :-)&lt;br /&gt;
** Then write a new mail -&amp;gt; Account (below Send button) -&amp;gt; select your new account -&amp;gt; Send test mail -&amp;gt; Prompted to choose the sent folder, ok -&amp;gt; you&#039;ve a multiple tabs config view of your new account, possibility to switch servers to TLS, changing name of the account, saying you need auth to talk to your SMTP etc etc&lt;br /&gt;
** If you need to tune IMAP settings later, go to registry and reset key (000000NN must be replaced with the number of your IMAP profile)&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\000000NN\IMAP Sentitems&lt;br /&gt;
 = 0&lt;br /&gt;
&lt;br /&gt;
Note that I also tried importing from Eudora Light &amp;amp; Eudora but Outlook didn&#039;t see anything&lt;br /&gt;
&lt;br /&gt;
=== Cached Exchange Mode ===&lt;br /&gt;
The following keys were set in my configuration, preventing to change the settings related to &#039;&#039;Cached Exchange Mode&#039;&#039;. In particular the mode selection was disabled, ie. the options &#039;&#039;Download full items&#039;&#039;, &#039;&#039;Download headers and then full items&#039;&#039;, &#039;&#039;Download headers&#039;&#039; were all grayed out.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;reg&amp;quot;&amp;gt;&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Cached Mode]&lt;br /&gt;
&amp;quot;CachedExchangeMode&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;Enable&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;NoDrizzle&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;NoFullItems&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;NoHeaders&amp;quot;=dword:00000000&lt;br /&gt;
&amp;quot;NoManualOnlineSync&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;SyncPFFav&amp;quot;=dword:00000001&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
To unlock all settings, and eg. allow download full headers, simply delete values &#039;&#039;CachedExchangeMode&#039;&#039;, &#039;&#039;NoDrizzle&#039;&#039;, &#039;&#039;NoFullItems&#039;&#039;, &#039;&#039;NoHeaders&#039;&#039;, and &#039;&#039;NoManualOnlineSync&#039;&#039; (ie. all but &#039;&#039;Enable&#039;&#039; and &#039;&#039;SyncPFFav&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
===Changing JunkMail levels===&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Options\Mail\JunkMailProtection&lt;br /&gt;
 No Protection = 0xffffffff = 4294967295&lt;br /&gt;
 Low = 6&lt;br /&gt;
 High = 3&lt;br /&gt;
 Trusted Lists Only = 0x80000000 = 2147483648&lt;br /&gt;
To enable the JunkMail otions in the Options-&amp;gt;Preferences-&amp;gt;E-Mail-&amp;gt;Junk E-mail menu&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\DisableAntiSpam&lt;br /&gt;
 =0&lt;br /&gt;
&lt;br /&gt;
===AutoArchive===&lt;br /&gt;
Recently the function &#039;&#039;AutoArchive&#039;&#039; vanished from Outlook, don&#039;t panic! To enable AutoArchive in the Menu-&amp;gt;File again just change the following registry value:&lt;br /&gt;
&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Preferences\DisableManualArchive = 0&lt;br /&gt;
&lt;br /&gt;
Changing this value is not sufficient to get access back the AutoArchive options. You need to delete the entire registry key &#039;&#039;Preferences&#039;&#039;. Not sure everything needs to go, but it does the work.&lt;br /&gt;
&lt;br /&gt;
 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Preferences]&lt;br /&gt;
&lt;br /&gt;
===All in one registry file===&lt;br /&gt;
You can also put all the above registry modifications in one single file [{{#file:Outlook.reg}} Outlook.reg]&lt;br /&gt;
&amp;lt;source lang=reg&amp;gt;&lt;br /&gt;
Windows Registry Editor Version 5.00&lt;br /&gt;
&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook]&lt;br /&gt;
&amp;quot;DisableAntiSpam&amp;quot;=dword:00000000&lt;br /&gt;
&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Cached Mode]&lt;br /&gt;
&amp;quot;NoFullItems&amp;quot;=-&lt;br /&gt;
&amp;quot;NoDrizzle&amp;quot;=-&lt;br /&gt;
&amp;quot;NoHeaders&amp;quot;=-&lt;br /&gt;
&amp;quot;CachedExchangeMode&amp;quot;=-&lt;br /&gt;
&amp;quot;NoManualOnlineSync&amp;quot;=-&lt;br /&gt;
&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Options\Mail]&lt;br /&gt;
&amp;quot;JunkMailProtection&amp;quot;=-&lt;br /&gt;
&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Setup]&lt;br /&gt;
&amp;quot;ModifyAccounts&amp;quot;=dword:00000000&lt;br /&gt;
&lt;br /&gt;
;Take care of that one, it could delete more than intended...&lt;br /&gt;
[-HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Preferences]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and modify the registry at each startup with the following command:&lt;br /&gt;
 regedit /s Outlook.reg&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: the hyphens after the registry value and in front of the registry key indicates respectively a request to delete the value and the entire key. See http://support.microsoft.com/kb/310516 for details.&lt;br /&gt;
&lt;br /&gt;
==Group Policy and other configuration hints==&lt;br /&gt;
&lt;br /&gt;
* [http://technet.microsoft.com/en-us/library/cc303396.aspx Configure Outlook security and protection features]&lt;br /&gt;
* [http://books.google.com/books?id=v8oZNEByTR0C&amp;amp;pg=PA232&amp;amp;lpg=PA232&amp;amp;dq=Outlook+policy+JunkMailProtection+registry&amp;amp;source=web&amp;amp;ots=NgPRrRu7ms&amp;amp;sig=0Fz7fiRm-hpc8GQTp9od3GtLLrM&amp;amp;hl=en&amp;amp;sa=X&amp;amp;oi=book_result&amp;amp;resnum=9&amp;amp;ct=result#PPA221,M1 Configuring Microsoft Outlook 2003]&lt;br /&gt;
&lt;br /&gt;
To use the Group Policy for Microsoft Outlook 2007 you may need to install the Outlook Group Policy template [http://www.yobi.be/files/outlk12.adm Outlk12.adm]&lt;br /&gt;
&lt;br /&gt;
# Copy the policy template Outlk12.adm into %WINDIR%\inf&lt;br /&gt;
# Open Group Policy Editor: Start-&amp;gt; Run-&amp;gt; gpedit.msc&lt;br /&gt;
# Add template:&lt;br /&gt;
## Select User Configuration&lt;br /&gt;
## Right-click on  Administrative Templates&lt;br /&gt;
## Select Add/Remove properties-&amp;gt; Click Add button&lt;br /&gt;
## Browse to %WINDIR%\inf and select Outlk12.adm&lt;br /&gt;
&lt;br /&gt;
==iCalendar==&lt;br /&gt;
Outlook does not handle correctly the iCal file (*.ics) with recurrent event.&lt;br /&gt;
&lt;br /&gt;
Problem: when opening (eg.: double-click on the attachment) an iCal file with multiple events, ie. multiple VEVENT sections, Outlook tries to add a complete calendar. Your are prompted with a dialog box with the following question: &#039;&#039;&#039;Add this Internet Calendar to Outlook&#039;&#039;&#039;. It is probably not what you want. Most probably you just need to add the multiple events in your existing calendar.&lt;br /&gt;
&lt;br /&gt;
The solution requires to save the iCal file on your hard drive and import it back using the import function.&lt;br /&gt;
&lt;br /&gt;
# Save file as...&lt;br /&gt;
# File -&amp;gt; Import and Export...&lt;br /&gt;
# Select &#039;&#039;Import and iCalendar (*.ics) or vCalendar (.vcs)&#039;&#039;&lt;br /&gt;
# Browse and select your saved iCal file, done.&lt;br /&gt;
&lt;br /&gt;
Solution source: https://events.sfu.ca/manual/en/iCalExporter.htm.&lt;br /&gt;
&lt;br /&gt;
==Moving PST location==&lt;br /&gt;
cf [http://azcarya.blogspot.com/2008/02/gmail-outlook-2007-and-imap.html this post]&lt;br /&gt;
&lt;br /&gt;
# Close Outlook.&lt;br /&gt;
# Open Control Panel -&amp;gt; Choose Mails -&amp;gt; Click on Data files.&lt;br /&gt;
# Select the Account name and check for the location of the PST file. Leave the window open.&lt;br /&gt;
# Open the folder containing the PST. Move the PST to the desired location.&lt;br /&gt;
# Do NOT rename the file - if you do Outlook creates a new file in the default location again.&lt;br /&gt;
# Switch to the Data Files window (as opened in Step 2) and double click on the PST file location.&lt;br /&gt;
# This displays an error window, Ignore the error, and point to the new location. Close the windows.&lt;br /&gt;
# Restart Outlook.&lt;br /&gt;
# Outlook may create a new PST in the default location again, delete it, in such a case.&lt;br /&gt;
&lt;br /&gt;
==Recovering PST password==&lt;br /&gt;
Password protection of PST is terribly wrong.&lt;br /&gt;
&lt;br /&gt;
Get [http://www.nirsoft.net/utils/pst_password.html PstPassword, a free Outlook PST Password Recovery], launch it and launch your PST, you&#039;ll get instantly a password, actuallt many passwords, and they will all work! How is it possible? Read [http://www.nirsoft.net/articles/pst_password_bug.html this].&lt;br /&gt;
&lt;br /&gt;
Note that McAfee detects the program as &amp;quot;Potentially Unwanted Program&amp;quot;, a &amp;quot;[http://vil.nai.com/vil/content/v_150020.htm Generic PUP.z]&amp;quot;:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;McAfee(R) Avert™ recognizes that this program may have legitimate uses in contexts where an authorized administrator has knowingly installed this application&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;But still no question, the program is simply erased by McAfee.&lt;br /&gt;
&amp;lt;br&amp;gt;One easy solution: open it under andLinux and run it with WINE :-)&lt;br /&gt;
&lt;br /&gt;
Apparently this can work both on &amp;quot;compressible encryption&amp;quot; and &amp;quot;high encryption&amp;quot; types of PST.&lt;br /&gt;
==Coping with enterprise backup policy==&lt;br /&gt;
The policy states:&lt;br /&gt;
*	Original e-mail and &#039;unique copies&#039; must be stored in the mailbox or in the Central Vault (a Symantec stuff for central storage). &lt;br /&gt;
*	Copies of original e-mail can be stored locally to support working offline for which the original is available in the mailbox or Central Vault. &lt;br /&gt;
*	Original e-mail is e-mail as it enters MS Outlook or Central Vault. &lt;br /&gt;
*	A &#039;unique copy&#039; is an original e-mail that has been modified. &lt;br /&gt;
*	This policy applies to all mailboxes in MS Outlook and Central Vault. &lt;br /&gt;
So what we can do is:&lt;br /&gt;
* Create a local .PST (or local IMAP) where you&#039;ll really archive your mails.&lt;br /&gt;
* Don&#039;t create folders in the exchange mailbox but instead in your local .PST&lt;br /&gt;
* In Exchange mailbox, only create a single folder called &#039;EV crap&#039; or &#039;EV overload&#039;, or simply &#039;EV&#039;&lt;br /&gt;
* To archive a mail, you copy it from Exchange Inbox to your local .PST, then you move it to your &#039;EV&#039; folder.&lt;br /&gt;
* Every once in a while you go to your &#039;EV&#039; folder, and you mass-send them to Enterprise Vault. Time to take a coffee break! (or two) (well, take a day off).&lt;br /&gt;
&lt;br /&gt;
You can setup a rule to do this automatically&lt;br /&gt;
&lt;br /&gt;
*	Go to Tools --&amp;gt; Rules and Alerts --&amp;gt; New Rules &lt;br /&gt;
*	Select Start from a blank rule / Check messages after sending, then click Next&lt;br /&gt;
*	Click Next again and confirm rules applies to all sent mails&lt;br /&gt;
*	Select &amp;quot;Move a copy to the specified folder&amp;quot;&lt;br /&gt;
*	Click on &amp;quot;specified&amp;quot;, and create a new EV folder in your inbox for instance, select &#039;EV&#039; folder. Click Next.&lt;br /&gt;
*	Click Next again (no exception) &lt;br /&gt;
** or optionally you can add exception for private mails by e.g. selecting &amp;quot;except if the subject contains specific words&amp;quot;&lt;br /&gt;
** Click on &amp;quot;specific words&amp;quot; and add your keywords, such as &amp;quot;private&amp;quot;, &amp;quot;Private&amp;quot;, &amp;quot;PRIVATE&amp;quot;, etc&lt;br /&gt;
*	Give rule a name (eg. Auto EV sent message), click Finish.&lt;br /&gt;
&lt;br /&gt;
You can do the same so that any incoming mail is automatically copied to given folder:&lt;br /&gt;
*	Go to Tools --&amp;gt; Rules and Alerts --&amp;gt; New Rules &lt;br /&gt;
*	Select Start from a blank rule / Check messages when they arrive, then click Next&lt;br /&gt;
*	Click Next again.&lt;br /&gt;
*	Select &amp;quot;Move a copy to the specified folder&amp;quot;&lt;br /&gt;
*	Click on &amp;quot;specified&amp;quot;, and create a new EV folder in your inbox for instance, select &#039;EV&#039; folder. Click Next.&lt;br /&gt;
*	Click Next again (no exception).&lt;br /&gt;
** or optionally you can add exception for private mails by e.g. selecting &amp;quot;except if the subject contains specific words&amp;quot;&lt;br /&gt;
** Click on &amp;quot;specific words&amp;quot; and add your keywords, such as &amp;quot;private&amp;quot;, &amp;quot;Private&amp;quot;, &amp;quot;PRIVATE&amp;quot;, etc&lt;br /&gt;
*	Give rule a name (eg. Auto EV incoming message), click Finish.&lt;br /&gt;
  &lt;br /&gt;
With these 2 rules, you can continue archive your mails normally in the local PST (remember don&#039;t make folders in exchange account, it&#039;s useless). For compliance with EV policy, you only need to go once in a while to the EV folder, and mass send all mails there in EV.&lt;br /&gt;
&lt;br /&gt;
Good luck!&lt;br /&gt;
&lt;br /&gt;
==Installing a local IMAP server on Windows==&lt;br /&gt;
One possibility is uw-imap in Cygwin but if you want to use courier-imap, compilation under Cygwin is a nightmare... not anymore, see [[Courier-Cygwin]]&lt;br /&gt;
&amp;lt;br&amp;gt;One easy way is to install courier-imap within AndLinux, e.g. following instructions at https://help.ubuntu.com/community/Courier&lt;br /&gt;
&lt;br /&gt;
==Macros==&lt;br /&gt;
===Installation===&lt;br /&gt;
To install a macro:&lt;br /&gt;
* Alt-F11 in Outlook&lt;br /&gt;
* Open Project1 -&amp;gt; Microsoft Office Outlook Objects -&amp;gt; ThisOutlookSession (double-click)&lt;br /&gt;
* copy/paste code&lt;br /&gt;
* close &amp;amp; save&lt;br /&gt;
If required, allow unsigned macros:&lt;br /&gt;
* Tools -&amp;gt; Macro -&amp;gt; Security -&amp;gt; Macro Security -&amp;gt; Warning for all macros&lt;br /&gt;
You&#039;ll have annoying popup at startup but there is no way around&lt;br /&gt;
&lt;br /&gt;
====Adding toolbar button to execute a Macro====&lt;br /&gt;
# Create a new toolbar. Right-click on any Outlook toolbar and choose &amp;quot;Customize.&amp;quot; From the Toolbars tab, hit the &amp;quot;New&amp;quot; button, and name your toolbar anything you want (like &amp;quot;my shortcuts&amp;quot;). Drag and drop your new toolbar to the top of Outlook to dock it next to your other toolbars.&lt;br /&gt;
# Add a Macro to your new toolbar. With the Customize dialog still open, go to its Commands tab. From the Commands tab, scroll down the Categories list, select Macros. In the Commands list select, drag and drop your Macro to your new toolbar.&lt;br /&gt;
# Customize your new shortcut/button. With the Customize dialog still open, go to its Commands tab. Click on the new button in the toolbar (not in the Customize dialog). The button &#039;&#039;Modify Selection&#039;&#039; in the Customize dialog is now enabled. Click on it to change multiple properties of your new toolbar button.&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lifehacker.com/381966/tweak-microsoft-outlook-to-empty-your-inbox-faster&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Todo: add the macro in the right-click menu.&lt;br /&gt;
&lt;br /&gt;
===Send &amp;amp; Save===&lt;br /&gt;
Lotus Notes can prompt the sender to specify what folder a message should be saved in. In Outlook, you can set the storage folder on the Options dialog. This VBA code reproduces something closer to the Notes behavior by popping up the Select Folder dialog when the user sends the message. (see [http://www.outlookcode.com/d/code/setsavefolder.htm here] and [http://www.outlookcode.com/codedetail.aspx?id=456 there])&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;UPDATE:&#039;&#039; Avoid treating appointments as it fails.&lt;br /&gt;
&amp;lt;source lang=vb&amp;gt;&lt;br /&gt;
Private Sub Application_ItemSend(ByVal Item As Object, _&lt;br /&gt;
    Cancel As Boolean)&lt;br /&gt;
  Dim objNS As NameSpace&lt;br /&gt;
  Dim objFolder As MAPIFolder&lt;br /&gt;
  Set objNS = Application.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
  If TypeOf Item Is MailItem Then&lt;br /&gt;
    Set objFolder = objNS.PickFolder&lt;br /&gt;
    If TypeName(objFolder) &amp;lt;&amp;gt; &amp;quot;Nothing&amp;quot; Then&lt;br /&gt;
         Set Item.SaveSentMessageFolder = objFolder&lt;br /&gt;
    End If&lt;br /&gt;
  End If&lt;br /&gt;
  Set objFolder = Nothing&lt;br /&gt;
  Set objNS = Nothing&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you don&#039;t want this pop-up all the time but to sort on casual base, you can use the built-in option:&lt;br /&gt;
* While writing a new mail, select &amp;quot;Options&amp;quot; tab (not the &amp;quot;Options&amp;quot; toolbar) -&amp;gt; &amp;quot;Save Sent Item&amp;quot; button -&amp;gt; Other Folder -&amp;gt; Select&lt;br /&gt;
&lt;br /&gt;
===Move To Archive===&lt;br /&gt;
Lotus Notes provided a way to archive mails manually. This feature is not supported by Outlook. To point is to select one or multiple mails in the inbox and move then with one single action to an archive folder. The following macro helps you to move mail into a dedicated archive folder (selected PST file + selected folder):&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;Note&#039;&#039;&#039;:You may need to change the name of the PST file (&#039;&#039;&amp;quot;Personal Folders&amp;quot;&#039;&#039;) and the target folder (&#039;&#039;&amp;quot;Ancient Archive&amp;quot;&#039;&#039;) according to your setup.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OBSOLETE&#039;&#039;&#039;: take a look at the macro &#039;&#039;Archive Now&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=vb&amp;gt;&lt;br /&gt;
Sub MoveToArchive()&lt;br /&gt;
On Error Resume Next&lt;br /&gt;
    Dim objFolder As Outlook.MAPIFolder&lt;br /&gt;
    Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem&lt;br /&gt;
&lt;br /&gt;
    Set objNS = Application.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
    Set objFolder = objNS.Folders(&amp;quot;Personal Folders&amp;quot;).Folders(&amp;quot;Ancient Archive&amp;quot;)&lt;br /&gt;
&#039;Assume this is a mail folder&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    If objFolder Is Nothing Then&lt;br /&gt;
        MsgBox &amp;quot;This folder doesn&#039;t exist!&amp;quot;, vbOKOnly + vbExclamation, &amp;quot;INVALID FOLDER&amp;quot;&lt;br /&gt;
    End If&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    If Application.ActiveExplorer.Selection.Count = 0 Then&lt;br /&gt;
        &#039;Require that this procedure be called only when a message is selected&lt;br /&gt;
        Exit Sub&lt;br /&gt;
    End If&lt;br /&gt;
 &lt;br /&gt;
    For Each objItem In Application.ActiveExplorer.Selection&lt;br /&gt;
        If objFolder.DefaultItemType = olMailItem Then&lt;br /&gt;
            If objItem.Class = olMail Then&lt;br /&gt;
                objItem.UnRead = False&lt;br /&gt;
                objItem.Move objFolder&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
    Next&lt;br /&gt;
 &lt;br /&gt;
    Set objItem = Nothing&lt;br /&gt;
    Set objFolder = Nothing&lt;br /&gt;
    Set objNS = Nothing&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;Solution source: http://www.yeraze.com/article.php/outlook_macro_move_to_folder_mark_Read&lt;br /&gt;
&lt;br /&gt;
===Archive Now===&lt;br /&gt;
The &#039;&#039;Archive Now&#039;&#039; macro better mimic the expected behavior of the &#039;&#039;Archive Selected Items&#039;&#039; of Lotus Notes (I never thought I would like to mimic anything from Lotus Notes,...) This &#039;&#039;Archive Now&#039;&#039; macro moves the selected mails, meetings and appointments (&#039;&#039;&#039;NEW&#039;&#039;&#039;) in the same sub-folder as its original location. Note that the archive operation does not depend on any time and date information. All selected mails, meetings and appointments will be archived/moved.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;Note&#039;&#039;&#039;: you may need or want to change the destination name (ie: &#039;&#039;&amp;quot;Archive Folders&amp;quot;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=vb&amp;gt;&lt;br /&gt;
&#039; Routine/Macro to archive selected mails into given data file&lt;br /&gt;
Sub ArchiveNow()&lt;br /&gt;
    On Error Resume Next&lt;br /&gt;
    MoveToFolder (&amp;quot;Archive Folders&amp;quot;)&lt;br /&gt;
End Sub&lt;br /&gt;
&#039;&lt;br /&gt;
&#039; Function to move selected mails into given data file&lt;br /&gt;
Public Function MoveToFolder(destName As String)&lt;br /&gt;
    Dim objNS As Outlook.NameSpace&lt;br /&gt;
    Dim objApp As Application&lt;br /&gt;
    Dim objFolder As Outlook.MAPIFolder&lt;br /&gt;
    Dim strCurrentFolderRootName As String&lt;br /&gt;
    Dim strDestinationFolderPath As String&lt;br /&gt;
    Dim objItem As Object&lt;br /&gt;
    &lt;br /&gt;
    On Error Resume Next&lt;br /&gt;
&lt;br /&gt;
    &#039; Some basic initialization, get app &amp;amp; namespace objects&lt;br /&gt;
    Set objApp = CreateObject(&amp;quot;Outlook.Application&amp;quot;)&lt;br /&gt;
    Set objNS = objApp.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    &#039; Abort if nothing selected&lt;br /&gt;
    If objApp.ActiveExplorer.Selection.Count = 0 Then&lt;br /&gt;
        &#039;Require that this procedure be called only when a message is selected&lt;br /&gt;
        Exit Function&lt;br /&gt;
    End If&lt;br /&gt;
    &lt;br /&gt;
    &#039; Abort if destination == source&lt;br /&gt;
    strCurrentFolderRootName = GetFolderRootName(objApp.ActiveExplorer.CurrentFolder)&lt;br /&gt;
    If strCurrentFolderRootName = destName Then&lt;br /&gt;
        &#039; Require that this procedure be called outside destination folder&lt;br /&gt;
        Exit Function&lt;br /&gt;
    End If&lt;br /&gt;
    &lt;br /&gt;
    &#039; Get destination folder path&lt;br /&gt;
    strDestinationFolderPath = Replace(objApp.ActiveExplorer.CurrentFolder.FolderPath, _&lt;br /&gt;
        &amp;quot;\\&amp;quot; + strCurrentFolderRootName, destName)&lt;br /&gt;
    &lt;br /&gt;
    &#039; Get destination folder object&lt;br /&gt;
    Set objFolder = GetFolder(strDestinationFolderPath)&lt;br /&gt;
    &lt;br /&gt;
    &#039; Check if destination folder exist, if not create it!&lt;br /&gt;
    If objFolder Is Nothing Then&lt;br /&gt;
        Dim Response&lt;br /&gt;
        Response = MsgBox(&amp;quot;Folder &#039;&amp;quot; + strDestinationFolderPath + &amp;quot;&#039; does not exist. &amp;quot; + _&lt;br /&gt;
            &amp;quot;Do you want to create it?&amp;quot;, vbYesNo + vbExclamation, &amp;quot;Folder not found&amp;quot;)&lt;br /&gt;
        If Response = vbYes Then&lt;br /&gt;
            CreateFolder (strDestinationFolderPath)&lt;br /&gt;
            Set objFolder = GetFolder(strDestinationFolderPath)&lt;br /&gt;
            If objFolder Is Nothing Then&lt;br /&gt;
                MsgBox &amp;quot;The destination folder creation failed!&amp;quot;, vbOKOnly + vbExclamation, &amp;quot;INVALID FOLDER&amp;quot;&lt;br /&gt;
                Exit Function&lt;br /&gt;
            End If&lt;br /&gt;
        Else&lt;br /&gt;
            Exit Function&lt;br /&gt;
        End If&lt;br /&gt;
    End If&lt;br /&gt;
    &lt;br /&gt;
    &#039; Move mails, meetings and appointments to destination folder&lt;br /&gt;
    For Each objItem In objApp.ActiveExplorer.Selection&lt;br /&gt;
        If objFolder.DefaultItemType = olMailItem Then&lt;br /&gt;
            &#039; Process Mail item&lt;br /&gt;
            If TypeOf objItem Is MailItem Then&lt;br /&gt;
                Dim objMailItem As Outlook.MailItem&lt;br /&gt;
                Set objMailItem = objItem&lt;br /&gt;
                objMailItem.UnRead = False&lt;br /&gt;
                objMailItem.Move objFolder&lt;br /&gt;
                Set objMailItem = Nothing&lt;br /&gt;
            End If&lt;br /&gt;
            &#039; Process Meeting item&lt;br /&gt;
            If TypeOf objItem Is MeetingItem Then&lt;br /&gt;
                Dim objMeetingItem As Outlook.MeetingItem&lt;br /&gt;
                Set objMeetingItem = objItem&lt;br /&gt;
                objMeetingItem.UnRead = False&lt;br /&gt;
                objMeetingItem.Move objFolder&lt;br /&gt;
                Set objMeetingItem = Nothing&lt;br /&gt;
            End If&lt;br /&gt;
            &#039; Process Appointment item - NOTE: not sure it will ever be necessary&lt;br /&gt;
            If TypeOf objItem Is AppointmentItem Then&lt;br /&gt;
                Dim objAppointItem As Outlook.AppointmentItem&lt;br /&gt;
                Set objAppointItem = objItem&lt;br /&gt;
                objAppointItem.UnRead = False&lt;br /&gt;
                objAppointItem.Move objFolder&lt;br /&gt;
                Set objAppointItem = Nothing&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
    Next&lt;br /&gt;
    &lt;br /&gt;
    Set objNS = Nothing&lt;br /&gt;
    Set objApp = Nothing&lt;br /&gt;
    Set objItem = Nothing&lt;br /&gt;
    Set objFolder = Nothing&lt;br /&gt;
End Function&lt;br /&gt;
&#039;&lt;br /&gt;
&#039; Function to returns the folder name of the top/root folder, just below the namespace&lt;br /&gt;
Public Function GetFolderRootName(objFolder As MAPIFolder) As String&lt;br /&gt;
    If Not objFolder.Parent.Class = olFolder Then&lt;br /&gt;
        GetFolderRootName = objFolder.Name&lt;br /&gt;
        Exit Function&lt;br /&gt;
    End If&lt;br /&gt;
    GetFolderRootName = GetFolderRootName(objFolder.Parent)&lt;br /&gt;
End Function&lt;br /&gt;
&#039;&lt;br /&gt;
&#039; Function to return a folder (object) specified by a full folder path&lt;br /&gt;
Public Function GetFolder(strFolderPath As String) As MAPIFolder&lt;br /&gt;
&lt;br /&gt;
  &#039; folder path needs to be something like&lt;br /&gt;
  &#039;   &amp;quot;Public Folders\All Public Folders\Company\Sales&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  Dim objApp As Outlook.Application&lt;br /&gt;
  Dim objNS As Outlook.NameSpace&lt;br /&gt;
  Dim colFolders As Outlook.Folders&lt;br /&gt;
  Dim objFolder As Outlook.MAPIFolder&lt;br /&gt;
  Dim arrFolders() As String&lt;br /&gt;
  Dim I As Long&lt;br /&gt;
&lt;br /&gt;
  On Error Resume Next&lt;br /&gt;
&lt;br /&gt;
  strFolderPath = Replace(strFolderPath, &amp;quot;/&amp;quot;, &amp;quot;\&amp;quot;)&lt;br /&gt;
  arrFolders() = Split(strFolderPath, &amp;quot;\&amp;quot;)&lt;br /&gt;
  Set objApp = CreateObject(&amp;quot;Outlook.Application&amp;quot;)&lt;br /&gt;
  Set objNS = objApp.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
  Set objFolder = objNS.Folders.Item(arrFolders(0))&lt;br /&gt;
&lt;br /&gt;
  If Not objFolder Is Nothing Then&lt;br /&gt;
    For I = 1 To UBound(arrFolders)&lt;br /&gt;
      Set colFolders = objFolder.Folders&lt;br /&gt;
      Set objFolder = Nothing&lt;br /&gt;
      Set objFolder = colFolders.Item(arrFolders(I))&lt;br /&gt;
      If objFolder Is Nothing Then&lt;br /&gt;
        Exit For&lt;br /&gt;
      End If&lt;br /&gt;
    Next&lt;br /&gt;
  End If&lt;br /&gt;
&lt;br /&gt;
  Set GetFolder = objFolder&lt;br /&gt;
  Set colFolders = Nothing&lt;br /&gt;
  Set objNS = Nothing&lt;br /&gt;
  Set objApp = Nothing&lt;br /&gt;
End Function&lt;br /&gt;
&#039;&lt;br /&gt;
&#039; Function to create a folder specified by a full folder path&lt;br /&gt;
Public Function CreateFolder(strFolderPath As String)&lt;br /&gt;
&lt;br /&gt;
    &#039; folder path needs to be something like&lt;br /&gt;
    &#039;   &amp;quot;Public Folders\All Public Folders\Company\Sales&amp;quot;&lt;br /&gt;
    Dim objNS As Outlook.NameSpace&lt;br /&gt;
    Dim objApp As Application&lt;br /&gt;
    Dim objFolder As Outlook.MAPIFolder&lt;br /&gt;
    Dim colFolders As Outlook.Folders&lt;br /&gt;
    Dim arrFolders() As String&lt;br /&gt;
&lt;br /&gt;
    On Error Resume Next&lt;br /&gt;
&lt;br /&gt;
    &#039; Some basic initialization, get app &amp;amp; namespace objects&lt;br /&gt;
    Set objApp = CreateObject(&amp;quot;Outlook.Application&amp;quot;)&lt;br /&gt;
    Set objNS = objApp.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    &#039; Build an array of folder names...&lt;br /&gt;
    strFolderPath = Replace(strFolderPath, &amp;quot;/&amp;quot;, &amp;quot;\&amp;quot;)&lt;br /&gt;
    strFolderPath = Replace(strFolderPath, &amp;quot;\\&amp;quot;, &amp;quot;&amp;quot;, 1, 1)&lt;br /&gt;
    arrFolders() = Split(strFolderPath, &amp;quot;\&amp;quot;)&lt;br /&gt;
    Set objFolder = objNS.Folders.Item(arrFolders(0))&lt;br /&gt;
  &lt;br /&gt;
    &#039; Process folders&lt;br /&gt;
    If Not objFolder Is Nothing Then&lt;br /&gt;
        For I = 1 To UBound(arrFolders)&lt;br /&gt;
            Set colFolders = objFolder.Folders&lt;br /&gt;
            Set objFolder = Nothing&lt;br /&gt;
            Set objFolder = colFolders.Item(arrFolders(I))&lt;br /&gt;
            If objFolder Is Nothing Then&lt;br /&gt;
                colFolders.Add (arrFolders(I))&lt;br /&gt;
                Set objFolder = colFolders.Item(arrFolders(I))&lt;br /&gt;
            End If&lt;br /&gt;
        Next&lt;br /&gt;
    End If&lt;br /&gt;
&lt;br /&gt;
    Set colFolders = Nothing&lt;br /&gt;
    Set objNS = Nothing&lt;br /&gt;
    Set objApp = Nothing&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Inspiration sources: &lt;br /&gt;
*http://www.outlookcode.com/codedetail.aspx?id=321&lt;br /&gt;
*http://www.outlookcode.com/codedetail.aspx?id=714&lt;br /&gt;
&lt;br /&gt;
==Interoperability between Exchange/Outlook &amp;amp; Linux==&lt;br /&gt;
&lt;br /&gt;
===PST to Maildir===&lt;br /&gt;
&lt;br /&gt;
* In Outlook:&lt;br /&gt;
** New -&amp;gt; Outlook Data File... -&amp;gt; Outlook 97-2002 Personal Folders file&lt;br /&gt;
** Copy/Move mails to it&lt;br /&gt;
** Right-Click on it -&amp;gt; Close it (probably safer)&lt;br /&gt;
* In Linux:&lt;br /&gt;
** Convert to mbox using readpst, then to Maildir using mb2md&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
mkdir pst&lt;br /&gt;
readpst -r -o pst backup.pst&lt;br /&gt;
find pst -name mbox -size 0 -exec rm {} \;&lt;br /&gt;
find pst -mindepth 2 -type d -print0|xargs --null -I XXX mb2md -s &amp;quot;$(pwd)/XXX/mbox&amp;quot; -&lt;br /&gt;
find pst -mindepth 2 -name mbox -print0|xargs --null rm&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I tried the PST Import plugin v1.2 for Thunderbird but it failed finding any mail in the PST&lt;br /&gt;
===Openchange===&lt;br /&gt;
I tried the one from Debian Experimental (version  1.0~svn679-1)&lt;br /&gt;
 mapiprofile --address=A.B.C.D --username=name --password=passwd --domain=DOM --workstation=BLABLA --profile=test --create&lt;br /&gt;
-&amp;gt; segfault from libmapi0&lt;br /&gt;
&lt;br /&gt;
I tried to compile the libmapi0 from the SVN, no segfault anymore but still failed&lt;br /&gt;
===Evolution===&lt;br /&gt;
Apparently ther is an attempt to support MAPI in a development branch but it has too much recent dependencies for me to compile it...&lt;br /&gt;
 svn checkout http://svn.gnome.org/svn/evolution/branches/EXCHANGE_MAPI_BRANCH&lt;br /&gt;
&lt;br /&gt;
 svn diff http://svn.gnome.org/svn/evolution/trunk http://svn.gnome.org/svn/evolution/branches/EXCHANGE_MAPI_BRANCH&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Outlook&amp;diff=5267</id>
		<title>Outlook</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Outlook&amp;diff=5267"/>
		<updated>2008-11-01T09:41:21Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Installing a local IMAP server on Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A page about Outlook on this wiki? Sounds weird isn&#039;t it?&lt;br /&gt;
&amp;lt;br&amp;gt;Well, blame my employer.&lt;br /&gt;
&lt;br /&gt;
We migrated from Lotus Notes, with crappy hacked outdated client so Outlook is still better but...&lt;br /&gt;
&amp;lt;br&amp;gt;At least under Lotus Notes it was possible to add an IMAP account (BTW Lotus Notes crashed quite often when talking IMAP...)&lt;br /&gt;
&amp;lt;br&amp;gt;Here: Tools-&amp;gt;Account Settings-&amp;gt;&#039;&#039;This feature has been disabled by your system administrator&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Microsoft Office 2007 Resource Kit (official documentation from Microsoft)&lt;br /&gt;
** [http://technet.microsoft.com/en-gb/library/cc178979.aspx Documentation page]&lt;br /&gt;
*** [http://go.microsoft.com/fwlink/?LinkId=85671 Security for the 2007 Office release]&lt;br /&gt;
*** [http://go.microsoft.com/fwlink/?LinkID=94264 Group Policy overview for the 2007 Office release]&lt;br /&gt;
** [http://go.microsoft.com/fwlink/?LinkId=78161 Administrative template (ADM,ADMX,...) files]&lt;br /&gt;
*** Use [http://www.7-zip.org/ 7-zip] to decompress this file without installing it. Don&#039;t miss the summary excel sheet inside.&lt;br /&gt;
* &#039;&#039;Configuring Microsoft Outlook 2003&#039;&#039;, By Sue Mosher, Robert Sparnaaij, Charlie Pulfer, David Hooker.&lt;br /&gt;
** Excellent book for administering Outlook 2003. Content can be browsed/searched on [http://books.google.com/books?id=v8oZNEByTR0C Google Books].&lt;br /&gt;
* Excellent 3rd party page on Outlook policy: http://www.howto-outlook.com/howto/policies.htm&lt;br /&gt;
* Folder with interesting policy settings on Outlook [http://theether.net/download/Microsoft/Office/2007/].&lt;br /&gt;
&lt;br /&gt;
== Unlocking ==&lt;br /&gt;
&lt;br /&gt;
===Main registry keys===&lt;br /&gt;
Apparently important registry keys are under:&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook&lt;br /&gt;
Some tips [http://www.hotline-pc.org/outlook.htm here] (french)&lt;br /&gt;
&lt;br /&gt;
===IMAP settings===&lt;br /&gt;
&lt;br /&gt;
We can remove the admin barrier on account management:&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Setup\ModifyAccounts&lt;br /&gt;
 =0&lt;br /&gt;
&lt;br /&gt;
Another way without modifying the Registry is to use the import feature:&lt;br /&gt;
&amp;lt;br&amp;gt;If e.g. Outlook Express client is also present on the Windows machine&lt;br /&gt;
* In Outlook Express:&lt;br /&gt;
** Wizard -&amp;gt; typed my IMAP&amp;amp;SMTP settings&lt;br /&gt;
* In Outlook:&lt;br /&gt;
** File -&amp;gt; Import and Export... -&amp;gt; Import Internet Mail Account Settings -&amp;gt; Microsoft Outlook Express or Microsoft Windows Mail -&amp;gt; Wizard allowing to edit the imported settings :-)&lt;br /&gt;
** Then write a new mail -&amp;gt; Account (below Send button) -&amp;gt; select your new account -&amp;gt; Send test mail -&amp;gt; Prompted to choose the sent folder, ok -&amp;gt; you&#039;ve a multiple tabs config view of your new account, possibility to switch servers to TLS, changing name of the account, saying you need auth to talk to your SMTP etc etc&lt;br /&gt;
** If you need to tune IMAP settings later, go to registry and reset key (000000NN must be replaced with the number of your IMAP profile)&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\000000NN\IMAP Sentitems&lt;br /&gt;
 = 0&lt;br /&gt;
&lt;br /&gt;
Note that I also tried importing from Eudora Light &amp;amp; Eudora but Outlook didn&#039;t see anything&lt;br /&gt;
&lt;br /&gt;
=== Cached Exchange Mode ===&lt;br /&gt;
The following keys were set in my configuration, preventing to change the settings related to &#039;&#039;Cached Exchange Mode&#039;&#039;. In particular the mode selection was disabled, ie. the options &#039;&#039;Download full items&#039;&#039;, &#039;&#039;Download headers and then full items&#039;&#039;, &#039;&#039;Download headers&#039;&#039; were all grayed out.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;reg&amp;quot;&amp;gt;&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Cached Mode]&lt;br /&gt;
&amp;quot;CachedExchangeMode&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;Enable&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;NoDrizzle&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;NoFullItems&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;NoHeaders&amp;quot;=dword:00000000&lt;br /&gt;
&amp;quot;NoManualOnlineSync&amp;quot;=dword:00000001&lt;br /&gt;
&amp;quot;SyncPFFav&amp;quot;=dword:00000001&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
To unlock all settings, and eg. allow download full headers, simply delete values &#039;&#039;CachedExchangeMode&#039;&#039;, &#039;&#039;NoDrizzle&#039;&#039;, &#039;&#039;NoFullItems&#039;&#039;, &#039;&#039;NoHeaders&#039;&#039;, and &#039;&#039;NoManualOnlineSync&#039;&#039; (ie. all but &#039;&#039;Enable&#039;&#039; and &#039;&#039;SyncPFFav&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
===Changing JunkMail levels===&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Options\Mail\JunkMailProtection&lt;br /&gt;
 No Protection = 0xffffffff = 4294967295&lt;br /&gt;
 Low = 6&lt;br /&gt;
 High = 3&lt;br /&gt;
 Trusted Lists Only = 0x80000000 = 2147483648&lt;br /&gt;
To enable the JunkMail otions in the Options-&amp;gt;Preferences-&amp;gt;E-Mail-&amp;gt;Junk E-mail menu&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\DisableAntiSpam&lt;br /&gt;
 =0&lt;br /&gt;
&lt;br /&gt;
===AutoArchive===&lt;br /&gt;
Recently the function &#039;&#039;AutoArchive&#039;&#039; vanished from Outlook, don&#039;t panic! To enable AutoArchive in the Menu-&amp;gt;File again just change the following registry value:&lt;br /&gt;
&lt;br /&gt;
 HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Preferences\DisableManualArchive = 0&lt;br /&gt;
&lt;br /&gt;
Changing this value is not sufficient to get access back the AutoArchive options. You need to delete the entire registry key &#039;&#039;Preferences&#039;&#039;. Not sure everything needs to go, but it does the work.&lt;br /&gt;
&lt;br /&gt;
 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Preferences]&lt;br /&gt;
&lt;br /&gt;
===All in one registry file===&lt;br /&gt;
You can also put all the above registry modifications in one single file [{{#file:Outlook.reg}} Outlook.reg]&lt;br /&gt;
&amp;lt;source lang=reg&amp;gt;&lt;br /&gt;
Windows Registry Editor Version 5.00&lt;br /&gt;
&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook]&lt;br /&gt;
&amp;quot;DisableAntiSpam&amp;quot;=dword:00000000&lt;br /&gt;
&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Cached Mode]&lt;br /&gt;
&amp;quot;NoFullItems&amp;quot;=-&lt;br /&gt;
&amp;quot;NoDrizzle&amp;quot;=-&lt;br /&gt;
&amp;quot;NoHeaders&amp;quot;=-&lt;br /&gt;
&amp;quot;CachedExchangeMode&amp;quot;=-&lt;br /&gt;
&amp;quot;NoManualOnlineSync&amp;quot;=-&lt;br /&gt;
&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Options\Mail]&lt;br /&gt;
&amp;quot;JunkMailProtection&amp;quot;=-&lt;br /&gt;
&lt;br /&gt;
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Setup]&lt;br /&gt;
&amp;quot;ModifyAccounts&amp;quot;=dword:00000000&lt;br /&gt;
&lt;br /&gt;
;Take care of that one, it could delete more than intended...&lt;br /&gt;
[-HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Preferences]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and modify the registry at each startup with the following command:&lt;br /&gt;
 regedit /s Outlook.reg&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: the hyphens after the registry value and in front of the registry key indicates respectively a request to delete the value and the entire key. See http://support.microsoft.com/kb/310516 for details.&lt;br /&gt;
&lt;br /&gt;
==Group Policy and other configuration hints==&lt;br /&gt;
&lt;br /&gt;
* [http://technet.microsoft.com/en-us/library/cc303396.aspx Configure Outlook security and protection features]&lt;br /&gt;
* [http://books.google.com/books?id=v8oZNEByTR0C&amp;amp;pg=PA232&amp;amp;lpg=PA232&amp;amp;dq=Outlook+policy+JunkMailProtection+registry&amp;amp;source=web&amp;amp;ots=NgPRrRu7ms&amp;amp;sig=0Fz7fiRm-hpc8GQTp9od3GtLLrM&amp;amp;hl=en&amp;amp;sa=X&amp;amp;oi=book_result&amp;amp;resnum=9&amp;amp;ct=result#PPA221,M1 Configuring Microsoft Outlook 2003]&lt;br /&gt;
&lt;br /&gt;
To use the Group Policy for Microsoft Outlook 2007 you may need to install the Outlook Group Policy template [http://www.yobi.be/files/outlk12.adm Outlk12.adm]&lt;br /&gt;
&lt;br /&gt;
# Copy the policy template Outlk12.adm into %WINDIR%\inf&lt;br /&gt;
# Open Group Policy Editor: Start-&amp;gt; Run-&amp;gt; gpedit.msc&lt;br /&gt;
# Add template:&lt;br /&gt;
## Select User Configuration&lt;br /&gt;
## Right-click on  Administrative Templates&lt;br /&gt;
## Select Add/Remove properties-&amp;gt; Click Add button&lt;br /&gt;
## Browse to %WINDIR%\inf and select Outlk12.adm&lt;br /&gt;
&lt;br /&gt;
==iCalendar==&lt;br /&gt;
Outlook does not handle correctly the iCal file (*.ics) with recurrent event.&lt;br /&gt;
&lt;br /&gt;
Problem: when opening (eg.: double-click on the attachment) an iCal file with multiple events, ie. multiple VEVENT sections, Outlook tries to add a complete calendar. Your are prompted with a dialog box with the following question: &#039;&#039;&#039;Add this Internet Calendar to Outlook&#039;&#039;&#039;. It is probably not what you want. Most probably you just need to add the multiple events in your existing calendar.&lt;br /&gt;
&lt;br /&gt;
The solution requires to save the iCal file on your hard drive and import it back using the import function.&lt;br /&gt;
&lt;br /&gt;
# Save file as...&lt;br /&gt;
# File -&amp;gt; Import and Export...&lt;br /&gt;
# Select &#039;&#039;Import and iCalendar (*.ics) or vCalendar (.vcs)&#039;&#039;&lt;br /&gt;
# Browse and select your saved iCal file, done.&lt;br /&gt;
&lt;br /&gt;
Solution source: https://events.sfu.ca/manual/en/iCalExporter.htm.&lt;br /&gt;
&lt;br /&gt;
==Moving PST location==&lt;br /&gt;
cf [http://azcarya.blogspot.com/2008/02/gmail-outlook-2007-and-imap.html this post]&lt;br /&gt;
&lt;br /&gt;
# Close Outlook.&lt;br /&gt;
# Open Control Panel -&amp;gt; Choose Mails -&amp;gt; Click on Data files.&lt;br /&gt;
# Select the Account name and check for the location of the PST file. Leave the window open.&lt;br /&gt;
# Open the folder containing the PST. Move the PST to the desired location.&lt;br /&gt;
# Do NOT rename the file - if you do Outlook creates a new file in the default location again.&lt;br /&gt;
# Switch to the Data Files window (as opened in Step 2) and double click on the PST file location.&lt;br /&gt;
# This displays an error window, Ignore the error, and point to the new location. Close the windows.&lt;br /&gt;
# Restart Outlook.&lt;br /&gt;
# Outlook may create a new PST in the default location again, delete it, in such a case.&lt;br /&gt;
&lt;br /&gt;
==Recovering PST password==&lt;br /&gt;
Password protection of PST is terribly wrong.&lt;br /&gt;
&lt;br /&gt;
Get [http://www.nirsoft.net/utils/pst_password.html PstPassword, a free Outlook PST Password Recovery], launch it and launch your PST, you&#039;ll get instantly a password, actuallt many passwords, and they will all work! How is it possible? Read [http://www.nirsoft.net/articles/pst_password_bug.html this].&lt;br /&gt;
&lt;br /&gt;
Note that McAfee detects the program as &amp;quot;Potentially Unwanted Program&amp;quot;, a &amp;quot;[http://vil.nai.com/vil/content/v_150020.htm Generic PUP.z]&amp;quot;:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;McAfee(R) Avert™ recognizes that this program may have legitimate uses in contexts where an authorized administrator has knowingly installed this application&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;But still no question, the program is simply erased by McAfee.&lt;br /&gt;
&amp;lt;br&amp;gt;One easy solution: open it under andLinux and run it with WINE :-)&lt;br /&gt;
&lt;br /&gt;
Apparently this can work both on &amp;quot;compressible encryption&amp;quot; and &amp;quot;high encryption&amp;quot; types of PST.&lt;br /&gt;
==Coping with enterprise backup policy==&lt;br /&gt;
The policy states:&lt;br /&gt;
*	Original e-mail and &#039;unique copies&#039; must be stored in the mailbox or in the Central Vault (a Symantec stuff for central storage). &lt;br /&gt;
*	Copies of original e-mail can be stored locally to support working offline for which the original is available in the mailbox or Central Vault. &lt;br /&gt;
*	Original e-mail is e-mail as it enters MS Outlook or Central Vault. &lt;br /&gt;
*	A &#039;unique copy&#039; is an original e-mail that has been modified. &lt;br /&gt;
*	This policy applies to all mailboxes in MS Outlook and Central Vault. &lt;br /&gt;
So what we can do is:&lt;br /&gt;
* Create a local .PST (or local IMAP) where you&#039;ll really archive your mails.&lt;br /&gt;
* Don&#039;t create folders in the exchange mailbox but instead in your local .PST&lt;br /&gt;
* In Exchange mailbox, only create a single folder called &#039;EV crap&#039; or &#039;EV overload&#039;, or simply &#039;EV&#039;&lt;br /&gt;
* To archive a mail, you copy it from Exchange Inbox to your local .PST, then you move it to your &#039;EV&#039; folder.&lt;br /&gt;
* Every once in a while you go to your &#039;EV&#039; folder, and you mass-send them to Enterprise Vault. Time to take a coffee break! (or two) (well, take a day off).&lt;br /&gt;
&lt;br /&gt;
You can setup a rule to do this automatically&lt;br /&gt;
&lt;br /&gt;
*	Go to Tools --&amp;gt; Rules and Alerts --&amp;gt; New Rules &lt;br /&gt;
*	Select Start from a blank rule / Check messages after sending, then click Next&lt;br /&gt;
*	Click Next again and confirm rules applies to all sent mails&lt;br /&gt;
*	Select &amp;quot;Move a copy to the specified folder&amp;quot;&lt;br /&gt;
*	Click on &amp;quot;specified&amp;quot;, and create a new EV folder in your inbox for instance, select &#039;EV&#039; folder. Click Next.&lt;br /&gt;
*	Click Next again (no exception) &lt;br /&gt;
** or optionally you can add exception for private mails by e.g. selecting &amp;quot;except if the subject contains specific words&amp;quot;&lt;br /&gt;
** Click on &amp;quot;specific words&amp;quot; and add your keywords, such as &amp;quot;private&amp;quot;, &amp;quot;Private&amp;quot;, &amp;quot;PRIVATE&amp;quot;, etc&lt;br /&gt;
*	Give rule a name (eg. Auto EV sent message), click Finish.&lt;br /&gt;
&lt;br /&gt;
You can do the same so that any incoming mail is automatically copied to given folder:&lt;br /&gt;
*	Go to Tools --&amp;gt; Rules and Alerts --&amp;gt; New Rules &lt;br /&gt;
*	Select Start from a blank rule / Check messages when they arrive, then click Next&lt;br /&gt;
*	Click Next again.&lt;br /&gt;
*	Select &amp;quot;Move a copy to the specified folder&amp;quot;&lt;br /&gt;
*	Click on &amp;quot;specified&amp;quot;, and create a new EV folder in your inbox for instance, select &#039;EV&#039; folder. Click Next.&lt;br /&gt;
*	Click Next again (no exception).&lt;br /&gt;
** or optionally you can add exception for private mails by e.g. selecting &amp;quot;except if the subject contains specific words&amp;quot;&lt;br /&gt;
** Click on &amp;quot;specific words&amp;quot; and add your keywords, such as &amp;quot;private&amp;quot;, &amp;quot;Private&amp;quot;, &amp;quot;PRIVATE&amp;quot;, etc&lt;br /&gt;
*	Give rule a name (eg. Auto EV incoming message), click Finish.&lt;br /&gt;
  &lt;br /&gt;
With these 2 rules, you can continue archive your mails normally in the local PST (remember don&#039;t make folders in exchange account, it&#039;s useless). For compliance with EV policy, you only need to go once in a while to the EV folder, and mass send all mails there in EV.&lt;br /&gt;
&lt;br /&gt;
Good luck!&lt;br /&gt;
&lt;br /&gt;
==Installing a local IMAP server on Windows==&lt;br /&gt;
One possibility is uw-imap in Cygwin but if you want to use courier-imap, compilation under Cygwin is a nightmare... not anymore see [[Courier-Cygwin]]&lt;br /&gt;
&amp;lt;br&amp;gt;One easy way is to install courier-imap within AndLinux, e.g. following instructions at https://help.ubuntu.com/community/Courier&lt;br /&gt;
&lt;br /&gt;
==Macros==&lt;br /&gt;
===Installation===&lt;br /&gt;
To install a macro:&lt;br /&gt;
* Alt-F11 in Outlook&lt;br /&gt;
* Open Project1 -&amp;gt; Microsoft Office Outlook Objects -&amp;gt; ThisOutlookSession (double-click)&lt;br /&gt;
* copy/paste code&lt;br /&gt;
* close &amp;amp; save&lt;br /&gt;
If required, allow unsigned macros:&lt;br /&gt;
* Tools -&amp;gt; Macro -&amp;gt; Security -&amp;gt; Macro Security -&amp;gt; Warning for all macros&lt;br /&gt;
You&#039;ll have annoying popup at startup but there is no way around&lt;br /&gt;
&lt;br /&gt;
====Adding toolbar button to execute a Macro====&lt;br /&gt;
# Create a new toolbar. Right-click on any Outlook toolbar and choose &amp;quot;Customize.&amp;quot; From the Toolbars tab, hit the &amp;quot;New&amp;quot; button, and name your toolbar anything you want (like &amp;quot;my shortcuts&amp;quot;). Drag and drop your new toolbar to the top of Outlook to dock it next to your other toolbars.&lt;br /&gt;
# Add a Macro to your new toolbar. With the Customize dialog still open, go to its Commands tab. From the Commands tab, scroll down the Categories list, select Macros. In the Commands list select, drag and drop your Macro to your new toolbar.&lt;br /&gt;
# Customize your new shortcut/button. With the Customize dialog still open, go to its Commands tab. Click on the new button in the toolbar (not in the Customize dialog). The button &#039;&#039;Modify Selection&#039;&#039; in the Customize dialog is now enabled. Click on it to change multiple properties of your new toolbar button.&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lifehacker.com/381966/tweak-microsoft-outlook-to-empty-your-inbox-faster&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Todo: add the macro in the right-click menu.&lt;br /&gt;
&lt;br /&gt;
===Send &amp;amp; Save===&lt;br /&gt;
Lotus Notes can prompt the sender to specify what folder a message should be saved in. In Outlook, you can set the storage folder on the Options dialog. This VBA code reproduces something closer to the Notes behavior by popping up the Select Folder dialog when the user sends the message. (see [http://www.outlookcode.com/d/code/setsavefolder.htm here] and [http://www.outlookcode.com/codedetail.aspx?id=456 there])&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;UPDATE:&#039;&#039; Avoid treating appointments as it fails.&lt;br /&gt;
&amp;lt;source lang=vb&amp;gt;&lt;br /&gt;
Private Sub Application_ItemSend(ByVal Item As Object, _&lt;br /&gt;
    Cancel As Boolean)&lt;br /&gt;
  Dim objNS As NameSpace&lt;br /&gt;
  Dim objFolder As MAPIFolder&lt;br /&gt;
  Set objNS = Application.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
  If TypeOf Item Is MailItem Then&lt;br /&gt;
    Set objFolder = objNS.PickFolder&lt;br /&gt;
    If TypeName(objFolder) &amp;lt;&amp;gt; &amp;quot;Nothing&amp;quot; Then&lt;br /&gt;
         Set Item.SaveSentMessageFolder = objFolder&lt;br /&gt;
    End If&lt;br /&gt;
  End If&lt;br /&gt;
  Set objFolder = Nothing&lt;br /&gt;
  Set objNS = Nothing&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you don&#039;t want this pop-up all the time but to sort on casual base, you can use the built-in option:&lt;br /&gt;
* While writing a new mail, select &amp;quot;Options&amp;quot; tab (not the &amp;quot;Options&amp;quot; toolbar) -&amp;gt; &amp;quot;Save Sent Item&amp;quot; button -&amp;gt; Other Folder -&amp;gt; Select&lt;br /&gt;
&lt;br /&gt;
===Move To Archive===&lt;br /&gt;
Lotus Notes provided a way to archive mails manually. This feature is not supported by Outlook. To point is to select one or multiple mails in the inbox and move then with one single action to an archive folder. The following macro helps you to move mail into a dedicated archive folder (selected PST file + selected folder):&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;Note&#039;&#039;&#039;:You may need to change the name of the PST file (&#039;&#039;&amp;quot;Personal Folders&amp;quot;&#039;&#039;) and the target folder (&#039;&#039;&amp;quot;Ancient Archive&amp;quot;&#039;&#039;) according to your setup.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OBSOLETE&#039;&#039;&#039;: take a look at the macro &#039;&#039;Archive Now&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=vb&amp;gt;&lt;br /&gt;
Sub MoveToArchive()&lt;br /&gt;
On Error Resume Next&lt;br /&gt;
    Dim objFolder As Outlook.MAPIFolder&lt;br /&gt;
    Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem&lt;br /&gt;
&lt;br /&gt;
    Set objNS = Application.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
    Set objFolder = objNS.Folders(&amp;quot;Personal Folders&amp;quot;).Folders(&amp;quot;Ancient Archive&amp;quot;)&lt;br /&gt;
&#039;Assume this is a mail folder&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    If objFolder Is Nothing Then&lt;br /&gt;
        MsgBox &amp;quot;This folder doesn&#039;t exist!&amp;quot;, vbOKOnly + vbExclamation, &amp;quot;INVALID FOLDER&amp;quot;&lt;br /&gt;
    End If&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    If Application.ActiveExplorer.Selection.Count = 0 Then&lt;br /&gt;
        &#039;Require that this procedure be called only when a message is selected&lt;br /&gt;
        Exit Sub&lt;br /&gt;
    End If&lt;br /&gt;
 &lt;br /&gt;
    For Each objItem In Application.ActiveExplorer.Selection&lt;br /&gt;
        If objFolder.DefaultItemType = olMailItem Then&lt;br /&gt;
            If objItem.Class = olMail Then&lt;br /&gt;
                objItem.UnRead = False&lt;br /&gt;
                objItem.Move objFolder&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
    Next&lt;br /&gt;
 &lt;br /&gt;
    Set objItem = Nothing&lt;br /&gt;
    Set objFolder = Nothing&lt;br /&gt;
    Set objNS = Nothing&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;Solution source: http://www.yeraze.com/article.php/outlook_macro_move_to_folder_mark_Read&lt;br /&gt;
&lt;br /&gt;
===Archive Now===&lt;br /&gt;
The &#039;&#039;Archive Now&#039;&#039; macro better mimic the expected behavior of the &#039;&#039;Archive Selected Items&#039;&#039; of Lotus Notes (I never thought I would like to mimic anything from Lotus Notes,...) This &#039;&#039;Archive Now&#039;&#039; macro moves the selected mails, meetings and appointments (&#039;&#039;&#039;NEW&#039;&#039;&#039;) in the same sub-folder as its original location. Note that the archive operation does not depend on any time and date information. All selected mails, meetings and appointments will be archived/moved.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;Note&#039;&#039;&#039;: you may need or want to change the destination name (ie: &#039;&#039;&amp;quot;Archive Folders&amp;quot;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=vb&amp;gt;&lt;br /&gt;
&#039; Routine/Macro to archive selected mails into given data file&lt;br /&gt;
Sub ArchiveNow()&lt;br /&gt;
    On Error Resume Next&lt;br /&gt;
    MoveToFolder (&amp;quot;Archive Folders&amp;quot;)&lt;br /&gt;
End Sub&lt;br /&gt;
&#039;&lt;br /&gt;
&#039; Function to move selected mails into given data file&lt;br /&gt;
Public Function MoveToFolder(destName As String)&lt;br /&gt;
    Dim objNS As Outlook.NameSpace&lt;br /&gt;
    Dim objApp As Application&lt;br /&gt;
    Dim objFolder As Outlook.MAPIFolder&lt;br /&gt;
    Dim strCurrentFolderRootName As String&lt;br /&gt;
    Dim strDestinationFolderPath As String&lt;br /&gt;
    Dim objItem As Object&lt;br /&gt;
    &lt;br /&gt;
    On Error Resume Next&lt;br /&gt;
&lt;br /&gt;
    &#039; Some basic initialization, get app &amp;amp; namespace objects&lt;br /&gt;
    Set objApp = CreateObject(&amp;quot;Outlook.Application&amp;quot;)&lt;br /&gt;
    Set objNS = objApp.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    &#039; Abort if nothing selected&lt;br /&gt;
    If objApp.ActiveExplorer.Selection.Count = 0 Then&lt;br /&gt;
        &#039;Require that this procedure be called only when a message is selected&lt;br /&gt;
        Exit Function&lt;br /&gt;
    End If&lt;br /&gt;
    &lt;br /&gt;
    &#039; Abort if destination == source&lt;br /&gt;
    strCurrentFolderRootName = GetFolderRootName(objApp.ActiveExplorer.CurrentFolder)&lt;br /&gt;
    If strCurrentFolderRootName = destName Then&lt;br /&gt;
        &#039; Require that this procedure be called outside destination folder&lt;br /&gt;
        Exit Function&lt;br /&gt;
    End If&lt;br /&gt;
    &lt;br /&gt;
    &#039; Get destination folder path&lt;br /&gt;
    strDestinationFolderPath = Replace(objApp.ActiveExplorer.CurrentFolder.FolderPath, _&lt;br /&gt;
        &amp;quot;\\&amp;quot; + strCurrentFolderRootName, destName)&lt;br /&gt;
    &lt;br /&gt;
    &#039; Get destination folder object&lt;br /&gt;
    Set objFolder = GetFolder(strDestinationFolderPath)&lt;br /&gt;
    &lt;br /&gt;
    &#039; Check if destination folder exist, if not create it!&lt;br /&gt;
    If objFolder Is Nothing Then&lt;br /&gt;
        Dim Response&lt;br /&gt;
        Response = MsgBox(&amp;quot;Folder &#039;&amp;quot; + strDestinationFolderPath + &amp;quot;&#039; does not exist. &amp;quot; + _&lt;br /&gt;
            &amp;quot;Do you want to create it?&amp;quot;, vbYesNo + vbExclamation, &amp;quot;Folder not found&amp;quot;)&lt;br /&gt;
        If Response = vbYes Then&lt;br /&gt;
            CreateFolder (strDestinationFolderPath)&lt;br /&gt;
            Set objFolder = GetFolder(strDestinationFolderPath)&lt;br /&gt;
            If objFolder Is Nothing Then&lt;br /&gt;
                MsgBox &amp;quot;The destination folder creation failed!&amp;quot;, vbOKOnly + vbExclamation, &amp;quot;INVALID FOLDER&amp;quot;&lt;br /&gt;
                Exit Function&lt;br /&gt;
            End If&lt;br /&gt;
        Else&lt;br /&gt;
            Exit Function&lt;br /&gt;
        End If&lt;br /&gt;
    End If&lt;br /&gt;
    &lt;br /&gt;
    &#039; Move mails, meetings and appointments to destination folder&lt;br /&gt;
    For Each objItem In objApp.ActiveExplorer.Selection&lt;br /&gt;
        If objFolder.DefaultItemType = olMailItem Then&lt;br /&gt;
            &#039; Process Mail item&lt;br /&gt;
            If TypeOf objItem Is MailItem Then&lt;br /&gt;
                Dim objMailItem As Outlook.MailItem&lt;br /&gt;
                Set objMailItem = objItem&lt;br /&gt;
                objMailItem.UnRead = False&lt;br /&gt;
                objMailItem.Move objFolder&lt;br /&gt;
                Set objMailItem = Nothing&lt;br /&gt;
            End If&lt;br /&gt;
            &#039; Process Meeting item&lt;br /&gt;
            If TypeOf objItem Is MeetingItem Then&lt;br /&gt;
                Dim objMeetingItem As Outlook.MeetingItem&lt;br /&gt;
                Set objMeetingItem = objItem&lt;br /&gt;
                objMeetingItem.UnRead = False&lt;br /&gt;
                objMeetingItem.Move objFolder&lt;br /&gt;
                Set objMeetingItem = Nothing&lt;br /&gt;
            End If&lt;br /&gt;
            &#039; Process Appointment item - NOTE: not sure it will ever be necessary&lt;br /&gt;
            If TypeOf objItem Is AppointmentItem Then&lt;br /&gt;
                Dim objAppointItem As Outlook.AppointmentItem&lt;br /&gt;
                Set objAppointItem = objItem&lt;br /&gt;
                objAppointItem.UnRead = False&lt;br /&gt;
                objAppointItem.Move objFolder&lt;br /&gt;
                Set objAppointItem = Nothing&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
    Next&lt;br /&gt;
    &lt;br /&gt;
    Set objNS = Nothing&lt;br /&gt;
    Set objApp = Nothing&lt;br /&gt;
    Set objItem = Nothing&lt;br /&gt;
    Set objFolder = Nothing&lt;br /&gt;
End Function&lt;br /&gt;
&#039;&lt;br /&gt;
&#039; Function to returns the folder name of the top/root folder, just below the namespace&lt;br /&gt;
Public Function GetFolderRootName(objFolder As MAPIFolder) As String&lt;br /&gt;
    If Not objFolder.Parent.Class = olFolder Then&lt;br /&gt;
        GetFolderRootName = objFolder.Name&lt;br /&gt;
        Exit Function&lt;br /&gt;
    End If&lt;br /&gt;
    GetFolderRootName = GetFolderRootName(objFolder.Parent)&lt;br /&gt;
End Function&lt;br /&gt;
&#039;&lt;br /&gt;
&#039; Function to return a folder (object) specified by a full folder path&lt;br /&gt;
Public Function GetFolder(strFolderPath As String) As MAPIFolder&lt;br /&gt;
&lt;br /&gt;
  &#039; folder path needs to be something like&lt;br /&gt;
  &#039;   &amp;quot;Public Folders\All Public Folders\Company\Sales&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  Dim objApp As Outlook.Application&lt;br /&gt;
  Dim objNS As Outlook.NameSpace&lt;br /&gt;
  Dim colFolders As Outlook.Folders&lt;br /&gt;
  Dim objFolder As Outlook.MAPIFolder&lt;br /&gt;
  Dim arrFolders() As String&lt;br /&gt;
  Dim I As Long&lt;br /&gt;
&lt;br /&gt;
  On Error Resume Next&lt;br /&gt;
&lt;br /&gt;
  strFolderPath = Replace(strFolderPath, &amp;quot;/&amp;quot;, &amp;quot;\&amp;quot;)&lt;br /&gt;
  arrFolders() = Split(strFolderPath, &amp;quot;\&amp;quot;)&lt;br /&gt;
  Set objApp = CreateObject(&amp;quot;Outlook.Application&amp;quot;)&lt;br /&gt;
  Set objNS = objApp.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
  Set objFolder = objNS.Folders.Item(arrFolders(0))&lt;br /&gt;
&lt;br /&gt;
  If Not objFolder Is Nothing Then&lt;br /&gt;
    For I = 1 To UBound(arrFolders)&lt;br /&gt;
      Set colFolders = objFolder.Folders&lt;br /&gt;
      Set objFolder = Nothing&lt;br /&gt;
      Set objFolder = colFolders.Item(arrFolders(I))&lt;br /&gt;
      If objFolder Is Nothing Then&lt;br /&gt;
        Exit For&lt;br /&gt;
      End If&lt;br /&gt;
    Next&lt;br /&gt;
  End If&lt;br /&gt;
&lt;br /&gt;
  Set GetFolder = objFolder&lt;br /&gt;
  Set colFolders = Nothing&lt;br /&gt;
  Set objNS = Nothing&lt;br /&gt;
  Set objApp = Nothing&lt;br /&gt;
End Function&lt;br /&gt;
&#039;&lt;br /&gt;
&#039; Function to create a folder specified by a full folder path&lt;br /&gt;
Public Function CreateFolder(strFolderPath As String)&lt;br /&gt;
&lt;br /&gt;
    &#039; folder path needs to be something like&lt;br /&gt;
    &#039;   &amp;quot;Public Folders\All Public Folders\Company\Sales&amp;quot;&lt;br /&gt;
    Dim objNS As Outlook.NameSpace&lt;br /&gt;
    Dim objApp As Application&lt;br /&gt;
    Dim objFolder As Outlook.MAPIFolder&lt;br /&gt;
    Dim colFolders As Outlook.Folders&lt;br /&gt;
    Dim arrFolders() As String&lt;br /&gt;
&lt;br /&gt;
    On Error Resume Next&lt;br /&gt;
&lt;br /&gt;
    &#039; Some basic initialization, get app &amp;amp; namespace objects&lt;br /&gt;
    Set objApp = CreateObject(&amp;quot;Outlook.Application&amp;quot;)&lt;br /&gt;
    Set objNS = objApp.GetNamespace(&amp;quot;MAPI&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    &#039; Build an array of folder names...&lt;br /&gt;
    strFolderPath = Replace(strFolderPath, &amp;quot;/&amp;quot;, &amp;quot;\&amp;quot;)&lt;br /&gt;
    strFolderPath = Replace(strFolderPath, &amp;quot;\\&amp;quot;, &amp;quot;&amp;quot;, 1, 1)&lt;br /&gt;
    arrFolders() = Split(strFolderPath, &amp;quot;\&amp;quot;)&lt;br /&gt;
    Set objFolder = objNS.Folders.Item(arrFolders(0))&lt;br /&gt;
  &lt;br /&gt;
    &#039; Process folders&lt;br /&gt;
    If Not objFolder Is Nothing Then&lt;br /&gt;
        For I = 1 To UBound(arrFolders)&lt;br /&gt;
            Set colFolders = objFolder.Folders&lt;br /&gt;
            Set objFolder = Nothing&lt;br /&gt;
            Set objFolder = colFolders.Item(arrFolders(I))&lt;br /&gt;
            If objFolder Is Nothing Then&lt;br /&gt;
                colFolders.Add (arrFolders(I))&lt;br /&gt;
                Set objFolder = colFolders.Item(arrFolders(I))&lt;br /&gt;
            End If&lt;br /&gt;
        Next&lt;br /&gt;
    End If&lt;br /&gt;
&lt;br /&gt;
    Set colFolders = Nothing&lt;br /&gt;
    Set objNS = Nothing&lt;br /&gt;
    Set objApp = Nothing&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;Inspiration sources: &lt;br /&gt;
*http://www.outlookcode.com/codedetail.aspx?id=321&lt;br /&gt;
*http://www.outlookcode.com/codedetail.aspx?id=714&lt;br /&gt;
&lt;br /&gt;
==Interoperability between Exchange/Outlook &amp;amp; Linux==&lt;br /&gt;
&lt;br /&gt;
===PST to Maildir===&lt;br /&gt;
&lt;br /&gt;
* In Outlook:&lt;br /&gt;
** New -&amp;gt; Outlook Data File... -&amp;gt; Outlook 97-2002 Personal Folders file&lt;br /&gt;
** Copy/Move mails to it&lt;br /&gt;
** Right-Click on it -&amp;gt; Close it (probably safer)&lt;br /&gt;
* In Linux:&lt;br /&gt;
** Convert to mbox using readpst, then to Maildir using mb2md&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
mkdir pst&lt;br /&gt;
readpst -r -o pst backup.pst&lt;br /&gt;
find pst -name mbox -size 0 -exec rm {} \;&lt;br /&gt;
find pst -mindepth 2 -type d -print0|xargs --null -I XXX mb2md -s &amp;quot;$(pwd)/XXX/mbox&amp;quot; -&lt;br /&gt;
find pst -mindepth 2 -name mbox -print0|xargs --null rm&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I tried the PST Import plugin v1.2 for Thunderbird but it failed finding any mail in the PST&lt;br /&gt;
===Openchange===&lt;br /&gt;
I tried the one from Debian Experimental (version  1.0~svn679-1)&lt;br /&gt;
 mapiprofile --address=A.B.C.D --username=name --password=passwd --domain=DOM --workstation=BLABLA --profile=test --create&lt;br /&gt;
-&amp;gt; segfault from libmapi0&lt;br /&gt;
&lt;br /&gt;
I tried to compile the libmapi0 from the SVN, no segfault anymore but still failed&lt;br /&gt;
===Evolution===&lt;br /&gt;
Apparently ther is an attempt to support MAPI in a development branch but it has too much recent dependencies for me to compile it...&lt;br /&gt;
 svn checkout http://svn.gnome.org/svn/evolution/branches/EXCHANGE_MAPI_BRANCH&lt;br /&gt;
&lt;br /&gt;
 svn diff http://svn.gnome.org/svn/evolution/trunk http://svn.gnome.org/svn/evolution/branches/EXCHANGE_MAPI_BRANCH&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5266</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5266"/>
		<updated>2008-11-01T09:37:03Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Compilation and installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;: list of related topics found during investigation for compilation&lt;br /&gt;
* authldap: configure: error: -lresolve is needed for res_query... http://www.cygwin.com/ml/cygwin/2005-04/msg00419.html&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5265</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5265"/>
		<updated>2008-11-01T09:24:51Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use three) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=3&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5263</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5263"/>
		<updated>2008-10-31T13:45:30Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Cygwin service */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=beq03798&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +rx /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5262</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5262"/>
		<updated>2008-10-31T13:44:49Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Cygwin service */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=beq03798&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps -a&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5261</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5261"/>
		<updated>2008-10-31T13:44:13Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Cygwin service */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:     imapd-service.sh&lt;br /&gt;
# Purpose:  Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# NOTE:     This script must be excutable by SYSTEM&lt;br /&gt;
username=beq03798&lt;br /&gt;
pidsleep=&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Function to handle QUIT signal.&lt;br /&gt;
# Stop imapd daemon and kill background sleep.&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	test -n &amp;quot;$pidsleep&amp;quot; &amp;amp;&amp;amp; kill -9 $pidsleep&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Interruptible sleep&lt;br /&gt;
# Note: sleep is an external command (not builtin command), hence&lt;br /&gt;
#       not interruptible by the QUIT signal.&lt;br /&gt;
function intsleep&lt;br /&gt;
{&lt;br /&gt;
	sleep $1 &amp;amp;&lt;br /&gt;
	pidsleep=$!&lt;br /&gt;
	wait $pidsleep&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username at &amp;quot;`date`&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING: &amp;quot;$$&lt;br /&gt;
while true; do intsleep 1d; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-service.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-service.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTES&#039;&#039;&#039;:&lt;br /&gt;
* If the service could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
* The combination of background sleep and builtin wait command is used to make the waiting statment interruptible. The original script found on the net, was simply using a &#039;sleep 1&#039; which turned to consume ~10% of the CPU.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5260</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5260"/>
		<updated>2008-10-30T21:29:28Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Cygwin service */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-srv.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting===&lt;br /&gt;
If the service is could not be started, it&#039;s probably because the service script is not executable by SYSTEM&lt;br /&gt;
&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
 The CYGWIN imapd service is starting.&lt;br /&gt;
 The CYGWIN imapd service could not be started. &lt;br /&gt;
 &lt;br /&gt;
 The service did not report an error.&lt;br /&gt;
 &lt;br /&gt;
 More help is available by typing NET HELPMSG 3534.&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5250</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5250"/>
		<updated>2008-10-26T15:37:15Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Compilation and installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5249</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5249"/>
		<updated>2008-10-26T15:36:00Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Compilation and installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:$AUTHLIBDIR/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5248</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5248"/>
		<updated>2008-10-26T14:31:31Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hint:&#039;&#039;&#039; if the connection is immediately closed by foreign host it probably means that &#039;&#039;imapd&#039;&#039; does not have access to all required DLLs. Check your PATH.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5247</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5247"/>
		<updated>2008-10-26T14:29:48Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemond and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5246</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5246"/>
		<updated>2008-10-26T14:29:07Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Running */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the imap daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemon and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5245</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5245"/>
		<updated>2008-10-26T14:26:42Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Testing authlib */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is your user name and XXXXXX is your encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemon and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5244</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5244"/>
		<updated>2008-10-26T14:26:08Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Running */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemon with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemon and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5243</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5243"/>
		<updated>2008-10-26T14:23:10Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Cygwin service */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemon and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username	# &amp;lt;&amp;lt;&amp;lt;&amp;lt; Change me !!!&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5242</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5242"/>
		<updated>2008-10-26T14:21:06Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Cygwin service */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemon and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
Finally, just start the service&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --start imapd&lt;br /&gt;
 or&lt;br /&gt;
 $ net start imapd&lt;br /&gt;
&lt;br /&gt;
You should now have couple of processes related to courier-imap&lt;br /&gt;
&lt;br /&gt;
 $ ps&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5241</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5241"/>
		<updated>2008-10-26T14:19:26Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Cygwin service */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemon and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
Create the [{{#file:imapd-srv.sh}} service script]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# File:		imapd-service.sh&lt;br /&gt;
# Purpose:	Courier imap daemon service script.&lt;br /&gt;
#&lt;br /&gt;
# This script must be excutable by SYSTEM&lt;br /&gt;
username=username&lt;br /&gt;
&lt;br /&gt;
function handleQuit&lt;br /&gt;
{&lt;br /&gt;
	echo &amp;quot;STOPPING: /usr/local/sbin/imapd&amp;quot;&lt;br /&gt;
	su $username -c &amp;quot;/usr/local/sbin/imapd stop&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;STARTING: /usr/local/sbin/imapd as $username&amp;quot;&lt;br /&gt;
su $username -c &amp;quot;/usr/local/sbin/imapd start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
trap &amp;quot;handleQuit&amp;quot; SIGQUIT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;WAITING&amp;quot;&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
sleep 1&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change username and save it to your favorite location, says /usr/local/sbin. The service script must be executable by SYSTEM, ie: the user that run the windows services.&lt;br /&gt;
&lt;br /&gt;
 $ chmod +x /usr/local/sbin/imapd-srv.sh&lt;br /&gt;
&lt;br /&gt;
Install the new service with the following command.&lt;br /&gt;
&lt;br /&gt;
 $ cygrunsrv --install imapd --desc &amp;quot;Courier IMAP daemon&amp;quot; --disp &amp;quot;CYGWIN imapd&amp;quot; \&lt;br /&gt;
   --path /usr/local/sbin/imapd-srv.sh --termsig QUIT --type auto --shutdown&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5240</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5240"/>
		<updated>2008-10-26T14:11:02Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* All in one */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
When authdaemon and imapd are running you can do a simple login test:&lt;br /&gt;
&lt;br /&gt;
 $ telnet localhost 143&lt;br /&gt;
&lt;br /&gt;
and type the login command&lt;br /&gt;
&lt;br /&gt;
 a login &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the server should reply&lt;br /&gt;
&lt;br /&gt;
 a OK LOGIN Ok.&lt;br /&gt;
&lt;br /&gt;
to which you can reply with a logout&lt;br /&gt;
&lt;br /&gt;
 a logout&lt;br /&gt;
&lt;br /&gt;
the session is terminated by the server&lt;br /&gt;
&lt;br /&gt;
 * BYE Courier-IMAP server shutting down&lt;br /&gt;
 a OK LOGOUT completed&lt;br /&gt;
 Connection closed by foreign host.&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5239</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5239"/>
		<updated>2008-10-26T10:16:15Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5238</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5238"/>
		<updated>2008-10-26T10:15:32Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Running */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
==All in one==&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cygwin service==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5237</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5237"/>
		<updated>2008-10-26T10:14:17Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5236</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5236"/>
		<updated>2008-10-26T10:12:49Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Compilation and installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-26 10:17:51.359375000 +0100&lt;br /&gt;
@@ -22,6 +22,15 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 TLS_CACHEFILE=&amp;quot;&amp;quot;&lt;br /&gt;
 . @sysconfdir@/imapd-ssl&lt;br /&gt;
 . @sysconfdir@/imapd&lt;br /&gt;
@@ -35,7 +44,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-26 10:18:02.187500000 +0100&lt;br /&gt;
@@ -22,12 +22,21 @@&lt;br /&gt;
 	exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
+# Location for some shared libraries (cygcourierauth*.dll) from authlib&lt;br /&gt;
+AUTHLIBDIR=/usr/local&lt;br /&gt;
+if test ! -f $AUTHLIBDIR/lib/bin/cygcourierauth.dll&lt;br /&gt;
+then&lt;br /&gt;
+	echo &amp;quot;$AUTHLIBDIR/lib/bin/cygcourierauth.dll not found.&amp;quot;&lt;br /&gt;
+	exit 1&lt;br /&gt;
+fi&lt;br /&gt;
+export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
+&lt;br /&gt;
 . @sysconfdir@/pop3d-ssl&lt;br /&gt;
 . @sysconfdir@/pop3d&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5235</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5235"/>
		<updated>2008-10-26T10:10:23Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Pre-requisite=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
=Courier Authentication Library=&lt;br /&gt;
&lt;br /&gt;
Installation of Courier Authentication Library using the module userdb to manage mail accounts. All other modules are disabled.&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Create authdaemonrc file: /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See http://www.courier-mta.org/authlib/README.authdebug.html for details.&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required, and create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10545)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;/usr/local/etc/authlib/userdb&#039;&#039;. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Config==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --version&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --ldflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --cppflags&lt;br /&gt;
 $ /usr/local/bin/courierauthconfig.exe --configfiles&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Courier-IMAP=&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200&lt;br /&gt;
@@ -35,7 +35,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200&lt;br /&gt;
@@ -27,7 +27,7 @@&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Syslogd service and authdaemond should be started. See above.&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
If everything works fine you can use the following [{{#file:imapd}} startup script] to launch or stop imap and authlib daemons. It can be saved in /usr/local/sbin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5234</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5234"/>
		<updated>2008-10-26T09:31:02Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Running */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Courier-IMAP=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool (version 1.5.27a-1)&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Library==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200&lt;br /&gt;
@@ -35,7 +35,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200&lt;br /&gt;
@@ -27,7 +27,7 @@&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
Setup authdaemon: /usr/local/etc/authlib/authdaemonrc. Create authdaemonrc file&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required. Create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
#&lt;br /&gt;
# Courier imap daemon startup script.&lt;br /&gt;
&lt;br /&gt;
authlib=/usr/local/sbin/authdaemond&lt;br /&gt;
imapd=/usr/lib/courier-imap/libexec/imapd.rc&lt;br /&gt;
&lt;br /&gt;
test ! -f $authlib &amp;amp;&amp;amp; echo &amp;quot;File not found: $authlib&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
test ! -f $imapd &amp;amp;&amp;amp; echo &amp;quot;File not found: $imapd&amp;quot; &amp;amp;&amp;amp; exit 1;&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
	start)&lt;br /&gt;
		$authlib start&lt;br /&gt;
		$imapd start&lt;br /&gt;
		;;&lt;br /&gt;
	stop)&lt;br /&gt;
		$imapd stop&lt;br /&gt;
		$authlib stop&lt;br /&gt;
		;;&lt;br /&gt;
	*)&lt;br /&gt;
		echo &amp;quot;Usage: $0 &amp;lt;start|stop&amp;gt;&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10111)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;userbd&#039;&#039; text file. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5233</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5233"/>
		<updated>2008-10-26T08:10:16Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Running */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Courier-IMAP=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool (version 1.5.27a-1)&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Library==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200&lt;br /&gt;
@@ -35,7 +35,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200&lt;br /&gt;
@@ -27,7 +27,7 @@&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
Setup authdaemon: /usr/local/etc/authlib/authdaemonrc. Create authdaemonrc file&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required. Create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
==Testing authlib==&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authtest username CCCCCC&lt;br /&gt;
 Authentication succeeded.&lt;br /&gt;
 &lt;br /&gt;
      Authenticated: username  (uid 1001, gid 10111)&lt;br /&gt;
     Home Directory: /home/username&lt;br /&gt;
            Maildir: /home/username/Maildir&lt;br /&gt;
              Quota: (none)&lt;br /&gt;
 Encrypted Password: XXXXXX&lt;br /&gt;
 Cleartext Password: CCCCCC&lt;br /&gt;
            Options: (none)&lt;br /&gt;
&lt;br /&gt;
where username is you user name and XXXXXX is you encrypted password as provided in &#039;&#039;userbd&#039;&#039; text file. CCCCCC is your password in clear.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
Should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039;, windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5232</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5232"/>
		<updated>2008-10-25T15:02:03Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Running */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Courier-IMAP=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool (version 1.5.27a-1)&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Library==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200&lt;br /&gt;
@@ -35,7 +35,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200&lt;br /&gt;
@@ -27,7 +27,7 @@&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
Setup authdaemon: /usr/local/etc/authlib/authdaemonrc. Create authdaemonrc file&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required. Create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; should you have a doubt on the execution of a command (ie: no output) you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039; windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5231</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5231"/>
		<updated>2008-10-25T14:57:06Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Running */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Courier-IMAP=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool (version 1.5.27a-1)&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Library==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200&lt;br /&gt;
@@ -35,7 +35,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200&lt;br /&gt;
@@ -27,7 +27,7 @@&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
Setup authdaemon: /usr/local/etc/authlib/authdaemonrc. Create authdaemonrc file&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required. Create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; should you have a doubt on the execution of a command you can check if the application is able to load required DLL. This error is not reported. Using &#039;&#039;strace&#039;&#039; windows will complain about DLL not found, if any. To solve this problem you may need to add some path in your PATH. For example, in order to test authlib with authtest:&lt;br /&gt;
&lt;br /&gt;
 $ strace /usr/local/sbin/authtest&lt;br /&gt;
     # This will open a dialog box to complain about DLL.&lt;br /&gt;
 $ export PATH=$PATH:/usr/local/lib/bin&lt;br /&gt;
 $ /usr/local/sbin/authtest ausername&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5230</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5230"/>
		<updated>2008-10-25T13:10:20Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Courier-IMAP=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool (version 1.5.27a-1)&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Library==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200&lt;br /&gt;
@@ -35,7 +35,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200&lt;br /&gt;
@@ -27,7 +27,7 @@&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Setup courier-imap: $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap)&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
Setup authdaemon: /usr/local/etc/authlib/authdaemonrc. Create authdaemonrc file&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required. Create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5228</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5228"/>
		<updated>2008-10-25T11:05:16Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* Courier Authentication Library */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Courier-IMAP=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool (version 1.5.27a-1)&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Library==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# add libtool flag (-no-undefined) required for DLL creation&lt;br /&gt;
# add missing dependencies&lt;br /&gt;
# add PATH in start script to access new DLL (installed in a different directory)&lt;br /&gt;
&lt;br /&gt;
Solution source: http://lists.cairographics.org/archives/cairo/2004-April/001125.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in	2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in	2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-23 22:59:03.843750000 +0200&lt;br /&gt;
@@ -213,9 +213,10 @@&lt;br /&gt;
 LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
 	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \&lt;br /&gt;
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)&lt;br /&gt;
-CCLD = $(CC)&lt;br /&gt;
+CCLD = $(CC) -no-undefined&lt;br /&gt;
+CCLDEXE = $(CC)&lt;br /&gt;
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \&lt;br /&gt;
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
+	--mode=link $(CCLDEXE) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \&lt;br /&gt;
 	$(LDFLAGS) -o $@&lt;br /&gt;
 SOURCES = $(libauthcustom_la_SOURCES) $(libauthldap_la_SOURCES) \&lt;br /&gt;
 	$(libauthmysql_la_SOURCES) $(libauthpam_la_SOURCES) \&lt;br /&gt;
@@ -452,9 +453,9 @@&lt;br /&gt;
 	README.authdebug.html&lt;br /&gt;
 &lt;br /&gt;
 DISTCLEANFILES = dbobj.config README_authlib.html&lt;br /&gt;
-commonlibdep = libcourierauthcommon.la&lt;br /&gt;
+commonlibdep = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 commonldflags = -module -rpath $(pkglibdir) -export-symbols-regex &#039;courier_auth.*_init&#039; -avoid-version&lt;br /&gt;
-commonlibadd = libcourierauthcommon.la&lt;br /&gt;
+commonlibadd = libcourierauthcommon.la libcourierauth.la&lt;br /&gt;
 libcourierauthcommon_t = @CRYPTLIBS@&lt;br /&gt;
 libcourierauthcommon_la_SOURCES = \&lt;br /&gt;
 	auth.h courierauth.h \&lt;br /&gt;
--- courier-authlib-0.61.0/authdaemond.in	2005-07-05 14:25:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/authdaemond.in	2008-10-25 12:03:32.140625000 +0200&lt;br /&gt;
@@ -15,4 +15,10 @@&lt;br /&gt;
 set -a&lt;br /&gt;
 . @authdaemonrc@&lt;br /&gt;
 &lt;br /&gt;
+# Some shared libraries (DLL) are installed in @libdir@/bin&lt;br /&gt;
+# instead of @libdir@/@PACKAGE@&lt;br /&gt;
+# Setting LD_LIBRARY_PATH at runtime or LR_RUN_PATH at linktime doesn&#039;t&lt;br /&gt;
+# work in cygwin, only setting PATH works. &lt;br /&gt;
+export PATH=$PATH:@libdir@/bin&lt;br /&gt;
+&lt;br /&gt;
 exec ${sbindir}/courierlogger -pid=@authdaemonvar@/pid $LOGGEROPTS -$1 @libexecdir@/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200&lt;br /&gt;
@@ -35,7 +35,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200&lt;br /&gt;
@@ -27,7 +27,7 @@&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD in $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap) to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
Setup authdaemon. Create authdaemonrc file&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required. Create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5225</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5225"/>
		<updated>2008-10-22T10:05:41Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: /* IMAP accounts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Courier-IMAP=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool (version 1.5.27a-1)&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Library==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# missing &#039;&#039;crypt&#039;&#039; library in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# incorrect or incompatible (text-)format of install library files (*.la). Unix like library name (as provided by &#039;dlname&#039;) are not used under cygwin. Hence skip the related operation in the installation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in  2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in   2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-21 18:51:47.093466600 +0200&lt;br /&gt;
@@ -1659,7 +1659,6 @@&lt;br /&gt;
 				$(DESTDIR)$(sbindir)/userdbpw ; \&lt;br /&gt;
 		$(INSTALL_SCRIPT) userdb-test-cram-md5.pl \&lt;br /&gt;
 				$(DESTDIR)$(sbindir)/userdb-test-cram-md5&lt;br /&gt;
-	for f in $(pkglib_LTLIBRARIES); do . $$f; rm -f $(DESTDIR)$(pkglibdir)/$$dlname.0 $(DESTDIR)$(pkglibdir)/$$dlname.0.0; ln -s $$dlname $(DESTDIR)$(pkglibdir)/$$dlname.0; done&lt;br /&gt;
 &lt;br /&gt;
 uninstall-hook: uninstall-authldaprc uninstall-authdaemonrc uninstall-authmysqlrc uninstall-authpgsqlrc&lt;br /&gt;
 	rm -f $(DESTDIR)$(pkglibexecdir)/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-custom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command. The &#039;&#039;LDFLAGS&#039;&#039; and &#039;&#039;LIBS&#039;&#039; variables are used to correct the second issue.&lt;br /&gt;
&lt;br /&gt;
 $ make LDFLAGS=-lcrypt LIBS=-lcrypt&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200&lt;br /&gt;
@@ -35,7 +35,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200&lt;br /&gt;
@@ -27,7 +27,7 @@&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD in $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap) to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
Setup authdaemon. Create authdaemonrc file&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See [http://linux.die.net/man/8/makeuserdb makeuserdb] man page for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required. Create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
	<entry>
		<id>https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5224</id>
		<title>Courier-Cygwin</title>
		<link rel="alternate" type="text/html" href="https://wiki.yobi.be/index.php?title=Courier-Cygwin&amp;diff=5224"/>
		<updated>2008-10-22T09:54:23Z</updated>

		<summary type="html">&lt;p&gt;Twalrant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Courier-IMAP=&lt;br /&gt;
&lt;br /&gt;
Courier-IMAP requires the installation of the [http://www.courier-mta.org/authlib/ Courier Authentication Library] and the following cygwin tools and packages&lt;br /&gt;
&lt;br /&gt;
* patch, tar, make, gcc&lt;br /&gt;
* crypt&lt;br /&gt;
* libgdbm-devel&lt;br /&gt;
* libtool (version 1.5.27a-1)&lt;br /&gt;
* inetutils&lt;br /&gt;
* cygrunsrv&lt;br /&gt;
&lt;br /&gt;
Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install the required packages.&lt;br /&gt;
&lt;br /&gt;
==Courier Authentication Library==&lt;br /&gt;
&lt;br /&gt;
Download and untar [http://www.courier-mta.org/download.php#authlib courier-authlib] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2 0.61.0]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# missing &#039;&#039;crypt&#039;&#039; library in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# incorrect or incompatible (text-)format of install library files (*.la). Unix like library name (as provided by &#039;dlname&#039;) are not used under cygwin. Hence skip the related operation in the installation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-authlib-0.61.0/makedat/Makefile.in  2008-05-24 16:21:09.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in   2008-10-21 16:02:38.709166700 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200&lt;br /&gt;
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-21 18:51:47.093466600 +0200&lt;br /&gt;
@@ -1659,7 +1659,6 @@&lt;br /&gt;
 				$(DESTDIR)$(sbindir)/userdbpw ; \&lt;br /&gt;
 		$(INSTALL_SCRIPT) userdb-test-cram-md5.pl \&lt;br /&gt;
 				$(DESTDIR)$(sbindir)/userdb-test-cram-md5&lt;br /&gt;
-	for f in $(pkglib_LTLIBRARIES); do . $$f; rm -f $(DESTDIR)$(pkglibdir)/$$dlname.0 $(DESTDIR)$(pkglibdir)/$$dlname.0.0; ln -s $$dlname $(DESTDIR)$(pkglibdir)/$$dlname.0; done&lt;br /&gt;
 &lt;br /&gt;
 uninstall-hook: uninstall-authldaprc uninstall-authdaemonrc uninstall-authmysqlrc uninstall-authpgsqlrc&lt;br /&gt;
 	rm -f $(DESTDIR)$(pkglibexecdir)/authdaemond&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-authlib-0.61.0-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package without most authentication modules, keeping only &#039;&#039;userdb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: replace &#039;&#039;mailuser&#039;&#039; by an existing user name (in your /etc/passwd file). I used my own username.&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \&lt;br /&gt;
 --without-authshadow --without-custom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \&lt;br /&gt;
 --with-mailgroup=mkgroup-l-d&lt;br /&gt;
&lt;br /&gt;
Take a long pause... and when ready execute the following command. The &#039;&#039;LDFLAGS&#039;&#039; and &#039;&#039;LIBS&#039;&#039; variables are used to correct the second issue.&lt;br /&gt;
&lt;br /&gt;
 $ make LDFLAGS=-lcrypt LIBS=-lcrypt&lt;br /&gt;
&lt;br /&gt;
Take again a long pause... then check the result and install the libraries&lt;br /&gt;
&lt;br /&gt;
 $ make check&lt;br /&gt;
 $ make install&lt;br /&gt;
&lt;br /&gt;
==Compilation and installation==&lt;br /&gt;
&lt;br /&gt;
Download and untar package [http://www.courier-mta.org/download.php#imap courier-imap] in your favorite sandbox.&lt;br /&gt;
Version used: [http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2 4.4.1.20080920]&lt;br /&gt;
&lt;br /&gt;
Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:&lt;br /&gt;
&lt;br /&gt;
# incorrect usage of EXEEXT in &#039;&#039;makedat/Makefile&#039;&#039;&lt;br /&gt;
# incorrect usage of EXTEXT in main &#039;&#039;Makefile&#039;&#039;&lt;br /&gt;
# remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=diff&amp;gt;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200&lt;br /&gt;
@@ -182,7 +182,7 @@&lt;br /&gt;
 libexecdir = @libexecdir@&lt;br /&gt;
 localedir = @localedir@&lt;br /&gt;
 localstatedir = @localstatedir@&lt;br /&gt;
-makedatprog_target = @makedatprog_target@&lt;br /&gt;
+makedatprog_target = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprogpath = @makedatprogpath@&lt;br /&gt;
 mandir = @mandir@&lt;br /&gt;
 mkdir_p = @mkdir_p@&lt;br /&gt;
@@ -198,7 +198,7 @@&lt;br /&gt;
 target_alias = @target_alias@&lt;br /&gt;
 top_builddir = @top_builddir@&lt;br /&gt;
 top_srcdir = @top_srcdir@&lt;br /&gt;
-noinst_PROGRAMS = @makedatprog_target@&lt;br /&gt;
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)&lt;br /&gt;
 makedatprog_SOURCES = makedatprog.c&lt;br /&gt;
 makedatprog_DEPENDENCIES = @dblibrary@&lt;br /&gt;
 makedatprog_LDADD = @dblibrary@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200&lt;br /&gt;
@@ -247,9 +247,9 @@&lt;br /&gt;
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)&lt;br /&gt;
 databindir = $(datadir)&lt;br /&gt;
 databin_SCRIPTS = mkimapdcert mkpop3dcert&lt;br /&gt;
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw&lt;br /&gt;
-sbinPROGRAMS = imaplogin pop3login&lt;br /&gt;
-libexecPROGRAMS = makedatprog couriertcpd&lt;br /&gt;
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)&lt;br /&gt;
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)&lt;br /&gt;
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)&lt;br /&gt;
 bin_PROGRAMS = @binPROGRAMS_exec@&lt;br /&gt;
 sbin_PROGRAMS = @sbinPROGRAMS_exec@&lt;br /&gt;
 libexec_PROGRAMS = @libexecPROGRAMS_exec@&lt;br /&gt;
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200&lt;br /&gt;
@@ -35,7 +35,7 @@&lt;br /&gt;
 &lt;br /&gt;
 	umask $IMAP_UMASK&lt;br /&gt;
 	@ULIMIT@ $IMAP_ULIMITD&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 			prefix=@prefix@ ;&lt;br /&gt;
 			exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 			bindir=@bindir@ ;&lt;br /&gt;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200&lt;br /&gt;
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200&lt;br /&gt;
@@ -27,7 +27,7 @@&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 start)&lt;br /&gt;
-	@SETENV@ -i @SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
+	@SHELL@ -c &amp;quot; set -a ;&lt;br /&gt;
 		prefix=@prefix@ ;&lt;br /&gt;
 		exec_prefix=@exec_prefix@ ;&lt;br /&gt;
 		bindir=@bindir@ ;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install the patch&lt;br /&gt;
&lt;br /&gt;
 $ patch -Np1 &amp;lt; courrier-imap-4.4.1-cygwin.patch&lt;br /&gt;
&lt;br /&gt;
Configure the package&lt;br /&gt;
&lt;br /&gt;
 $ ./configure --disable-root-check --with-waitfunc=wait&lt;br /&gt;
&lt;br /&gt;
Take a walk... and when ready execute the following command to build the package.&lt;br /&gt;
&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Time to go for some coffee... and then install the package with the usual&lt;br /&gt;
&lt;br /&gt;
 $ make install&lt;br /&gt;
 $ make install-configure&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD in $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap) to a value accepted by the command ulimit. I simply used the existing value returned by&lt;br /&gt;
&lt;br /&gt;
 $ ulimit -v&lt;br /&gt;
&lt;br /&gt;
Setup authdaemon. Create authdaemonrc file&lt;br /&gt;
&lt;br /&gt;
 $ cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc&lt;br /&gt;
&lt;br /&gt;
Change number of daemons (I use only one) and enable DEBUG_LOGIN&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
# The number of daemon processes that are started.&lt;br /&gt;
daemons=1&lt;br /&gt;
# DEBUG_LOGIN=2   - turn on debugging + log passwords too&lt;br /&gt;
DEBUG_LOGIN=2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IMAP accounts==&lt;br /&gt;
&lt;br /&gt;
User accounts and settings are managed by &#039;&#039;userdb&#039;&#039;. See http://linux.die.net/man/8/makeuserdb for details, or used the freshly new install man page - man makeuserdb&lt;br /&gt;
&lt;br /&gt;
Assuming &#039;&#039;username&#039;&#039; is your username, 1001 and 10545 are respectively the UID and GID of an existing user (part of your /etc/passwd and /etc/group). I use my own UID and GID. Create the mailuser home directory, if required. Create Maildir folder.&lt;br /&gt;
&lt;br /&gt;
 $ mkdir -p /home/username&lt;br /&gt;
 $ cd /home/username&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake Maildir&lt;br /&gt;
&lt;br /&gt;
Create the userdb text file /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
 $ touch /usr/local/etc/authlib/userdb&lt;br /&gt;
 $ chmod 700 /usr/local/etc/authlib/userdb&lt;br /&gt;
&lt;br /&gt;
Edit /usr/local/etc/authlib/userdb, one line per account&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
username[TAB]uid=1001|gid=10111|home=/home/username|mail=/home/username/Maildir|systempw=XXXXXX&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where XXXXXX is the encrypted password created with&lt;br /&gt;
&lt;br /&gt;
 $  /usr/local/sbin/userdbpw.exe&lt;br /&gt;
&lt;br /&gt;
Create the (binary) userdb&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/makeuserdb&lt;br /&gt;
&lt;br /&gt;
You should now have the following files created:&lt;br /&gt;
&lt;br /&gt;
* /usr/local/etc/authlib/userdb.dat&lt;br /&gt;
* /usr/local/etc/authlib/userdbshadow.dat&lt;br /&gt;
&lt;br /&gt;
==Running==&lt;br /&gt;
&lt;br /&gt;
Install and configure syslogd. Run the [http://www.cygwin.com/setup.exe Cygwin setup] program. Locate, select and install inetutils (contains syslogd). Configure syslogd with the following command. It will create the /etc/syslogd.conf file and install a windows service using cygrunsrv&lt;br /&gt;
&lt;br /&gt;
 $ syslogd-config&lt;br /&gt;
&lt;br /&gt;
Start the authlib and imap daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/local/sbin/authdaemon start&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
&lt;br /&gt;
Stop the daemons with the following command:&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/libexec/imapd.rc stop&lt;br /&gt;
 $ /usr/local/sbin/authdaemon stop&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find log messages in /var/log/messages (default target file as specified in /etc/syslogd.conf)&lt;br /&gt;
&lt;br /&gt;
=Maildir=&lt;br /&gt;
&#039;&#039;&#039;maildirmake&#039;&#039;&#039; is part of the courier-imap package&lt;br /&gt;
&lt;br /&gt;
 $ /usr/lib/courier-imap/bin/maildirmake&lt;/div&gt;</summary>
		<author><name>Twalrant</name></author>
	</entry>
</feed>