1 | ENABLING MAILDIR, CONFIGURING IMAP AND POP |
---|
2 | ------------------------------------------ |
---|
3 | |
---|
4 | 1. Edit the file "main.cf" (using vi or ee) |
---|
5 | |
---|
6 | Add the following lines to main.cf: |
---|
7 | |
---|
8 | home_mailbox = Maildir/ |
---|
9 | |
---|
10 | 2. Create a Maildir folder for the sanog user: |
---|
11 | |
---|
12 | (DO THIS AS THE SANOG USER!) |
---|
13 | |
---|
14 | $ mkdir /home/sanog/Maildir |
---|
15 | |
---|
16 | Note: if you do not do this as the sanog user, |
---|
17 | the mail system will NOT be able to deliver mail. |
---|
18 | |
---|
19 | 3. Try sendmail mail again to your domain: |
---|
20 | |
---|
21 | $ echo "test with maildir" | mail -s "test maildir" sanog@YOURDOMAIN.ws3... |
---|
22 | |
---|
23 | * Now, run mutt again: |
---|
24 | |
---|
25 | $ mutt |
---|
26 | |
---|
27 | ... do you see your mail ? |
---|
28 | |
---|
29 | No, the reason is that now the mail is not stored in /var/mail, |
---|
30 | but in the "Maildir/" directory in your home dir. |
---|
31 | |
---|
32 | To access it, first quit mutt ('q'), then relaunch mutt like this: |
---|
33 | |
---|
34 | $ mutt -f ~sanog/Maildir/ |
---|
35 | |
---|
36 | ... this explicitly tells mutt to access the "Maildir" in the |
---|
37 | home (~) directory of the user "sanog". |
---|
38 | |
---|
39 | Why Maildir ? It's a better mail storage format when many mails |
---|
40 | need to be accessed quickly - one email / file on the disk. |
---|
41 | |
---|
42 | |
---|
43 | But what if you want to read your mail remotely ? |
---|
44 | |
---|
45 | 4. Configure the "courier IMAP" daemon |
---|
46 | |
---|
47 | * Add the following lines to the end of your /etc/rc.conf file: |
---|
48 | |
---|
49 | courier_authdaemond_enable="YES" |
---|
50 | courier_imap_imapd_enable="YES" |
---|
51 | courier_imap_pop3d_enable="YES" |
---|
52 | |
---|
53 | * Now start it: |
---|
54 | |
---|
55 | # /usr/local/etc/rc.d/courier-authdaemond start |
---|
56 | # /usr/local/etc/rc.d/courier-imap-imapd start |
---|
57 | # /usr/local/etc/rc.d/courier-imap-pop3d start |
---|
58 | |
---|
59 | 5. You may now use mutt to read your mail via POP, and IMAP |
---|
60 | |
---|
61 | * First, tell mutt NOT to attempt SSL negotiation: |
---|
62 | |
---|
63 | $ echo 'set ssl_starttls = no' > /home/sanog/.muttrc |
---|
64 | |
---|
65 | (We have not configured an SSL certificate yet, therefore we need |
---|
66 | to disable this option for the time being) |
---|
67 | |
---|
68 | Now, run mutt: |
---|
69 | |
---|
70 | POP: |
---|
71 | |
---|
72 | $ mutt -f pop://sanog@wsXX (where wsXX is your own machine) |
---|
73 | Password for sanog@wsXX: |
---|
74 | |
---|
75 | IMAP: |
---|
76 | |
---|
77 | $ mutt -f imap://sanog@wsXX (where wsXX is your own machine) |
---|
78 | Password for sanog@wsXX: |
---|
79 | |
---|
80 | ... you can now read your mail remotely, and you can also read mail |
---|
81 | on other machines: |
---|
82 | |
---|
83 | $ mutt -f pop://sanog@wsYY (where wsYY is another machine in the room) |
---|
84 | or |
---|
85 | $ mutt -f imap://sanog@wsYY (where wsYY is another machine in the room) |
---|
86 | |
---|
87 | 6. Open another window (or terminal), and log in as 'root'. |
---|
88 | |
---|
89 | * Now, run tcpdump so you can see the contents of the traffic on |
---|
90 | the POP (110) and IMAP (143) ports: |
---|
91 | |
---|
92 | # tcpdump -X -s0 -n port 143 or port 110 |
---|
93 | |
---|
94 | * Now ask someone else to read mail on YOUR server |
---|
95 | |
---|
96 | * What do you observe in the tcpdump window ? |
---|
97 | |
---|