Now we will implement an imap server. The big advantage to using imap won't become apparent until we configure our webmail server, but we do need it.
# portinstall mail/courier-imap
when the option screens display, ensure you enable mysql support!
In case you use authpam, you should put the following lines in your /etc/pam.d/imap
# echo 'account required pam_unix.so try_first_pass' >> /etc/pam.d/imap
# echo 'session required pam_permit.so' >> /etc/pam.d/imap
The default has courier-imap listening an ALL IP addresses. To have it listen on only the host's IP, add the following (using your host's real IP of course). ***NOTE*** For Squirrelmail users, when you set the host IP here, you MUST configure Squirrelmail's IMAP Server with the same host IP (not the 'localhost' default) or courier-imap will refuse your connection.
# nano +24 /usr/local/etc/courier-imap/imapd
ADDRESS=192.168.1.xxx
# nano +96 /usr/local/etc/courier-imap/pop3d
ADDRESS=192.168.1.xxx
Enable courier-imap to start on boot by adding this to rc.conf.
# echo 'courier_imap_imapd_enable="YES"' >> /etc/rc.conf
# echo 'courier_authdaemond_enable="YES"' >> /etc/rc.conf
Also, if you want the POP3 service, add this to rc.conf as well.
# echo 'courier_imap_pop3d_enable="YES"' >> /etc/rc.conf
reboot your system to ensure everything loads up correctly.
# reboot
Log back in and check to see if the services are running by seeing if the port shows LISTENING
For IMAP
# netstat -a|grep imap
For Pop3
# netstat -a|grep pop3
We now have an IMAP server running with Maildirs. Next step is to get a webmail server working on this installation!