ENABLING MAILDIR, CONFIGURING IMAP AND POP ------------------------------------------ 1. Edit the file "main.cf" (using vi or ee) Add the following lines to main.cf: home_mailbox = Maildir/ 2. Create a Maildir folder for the sanog user: (DO THIS AS THE SANOG USER!) $ mkdir /home/sanog/Maildir Note: if you do not do this as the sanog user, the mail system will NOT be able to deliver mail. 3. Try sendmail mail again to your domain: $ echo "test with maildir" | mail -s "test maildir" sanog@YOURDOMAIN.ws3... * Now, run mutt again: $ mutt ... do you see your mail ? No, the reason is that now the mail is not stored in /var/mail, but in the "Maildir/" directory in your home dir. To access it, first quit mutt ('q'), then relaunch mutt like this: $ mutt -f ~sanog/Maildir/ ... this explicitly tells mutt to access the "Maildir" in the home (~) directory of the user "sanog". Why Maildir ? It's a better mail storage format when many mails need to be accessed quickly - one email / file on the disk. But what if you want to read your mail remotely ? 4. Configure the "courier IMAP" daemon * Add the following lines to the end of your /etc/rc.conf file: courier_authdaemond_enable="YES" courier_imap_imapd_enable="YES" courier_imap_pop3d_enable="YES" * Now start it: # /usr/local/etc/rc.d/courier-authdaemond start # /usr/local/etc/rc.d/courier-imap-imapd start # /usr/local/etc/rc.d/courier-imap-pop3d start 5. You may now use mutt to read your mail via POP, and IMAP * First, tell mutt NOT to attempt SSL negotiation: $ echo 'set ssl_starttls = no' > /home/sanog/.muttrc (We have not configured an SSL certificate yet, therefore we need to disable this option for the time being) Now, run mutt: POP: $ mutt -f pop://sanog@wsXX (where wsXX is your own machine) Password for sanog@wsXX: IMAP: $ mutt -f imap://sanog@wsXX (where wsXX is your own machine) Password for sanog@wsXX: ... you can now read your mail remotely, and you can also read mail on other machines: $ mutt -f pop://sanog@wsYY (where wsYY is another machine in the room) or $ mutt -f imap://sanog@wsYY (where wsYY is another machine in the room) 6. Open another window (or terminal), and log in as 'root'. * Now, run tcpdump so you can see the contents of the traffic on the POP (110) and IMAP (143) ports: # tcpdump -X -s0 -n port 143 or port 110 * Now ask someone else to read mail on YOUR server * What do you observe in the tcpdump window ?