Installing IMAP
Collect your Unix email from across the network (FreeBSD 5.2)
Posted 06.10.2003 | Updated 08.03.2007 | Contributed by Andy Mallett


IMAP Mail

IMAP stands for Internet Message Access Protocol.

It is a method of accessing email, say from a workstation, which is kept on a remote mail server.
In this case the mail server is the Unix box itself. By default BSD emails system and other messages to user accounts on the server itself, where they can be read when a user logs in. IMAP simply allows users to collect their mail remotely, by connecting to the Unix mail sewrver using a normal email client like Outlook.

Making it Happen

Grab IMAP from a Google search. I used version imap-2000c.tar.Z [1.79MB]. Download it to the usual repository for installs, /src (or /usr/local/src if you like typing a lot..).

Move into the download directory and unpack the imap tarball:

cd  /src

tar  -zxvf  imap-2000c.tar.Z


Move into the newly created imap directory..

cd  imap-2000c

..and run the following command:

make  bsf

Copy the following imapd and ipop3d daemon files into the /usr/libexec directory:

cp  /src/imap-2000c/imapd/imapd  /usr/libexec
cp  /src/imap-2000c/ipopd/ipop3d  /usr/libexec


Next, edit inetd.conf to point to these two daemons:

vi  /etc/inetd.conf

Unhash the following lines in inetd.conf:

#pop3   stream  tcp  nowait  root  /usr/local/libexec/popper    popper
#imap4  stream  tcp  nowait  root  /usr/local/libexec/imapd    imapd


Be careful here to keep to the existing spaces between fields above. Overwrite the original paths and don't mess with the gaps between words..

After unhashing them, edit the lines to read:

pop3   stream tcp  nowait  root  /usr/libexec/ipop3d    ipop3d
imap4  stream  tcp  nowait  root  /usr/libexec/imapd    imapd


Save and exit inetd.conf

IMAP is started from inetd.conf, which is in turn started from rc.conf. Edit this file and make sure the following line is present..

vi  /etc/rc.conf
inetd_enable="YES"


Finally restart the machine.. (or kill the existing inetd process and start it again with inetd  -wW)

reboot

To test that imap is running properly, use the mail command on your FreeBSD box to send a test email to a vaild user (not root) of the FreeBSD box. On a remote machine use an email program like Outlook to receive your test email message.

Using the username and password of the user that you sent your test email to, fill in the account name and password of the email program. Use the IP address of your FreeBSD box for the incoming and outgoing mail servers.

Example (change you settings to suit)
Andy has a Unix box called vampyre.it.net, with an IP of 10.0.1.111
His Unix username is andym, making his email account andy@vampyre
Not surprisingly his login name is andym
The SMTP Server (sending) and POP3 (receiving) settings are both 10.0.1.111



You should be able to receive the test email that you sent. Be patient when testing your IMAP server - it can take a few minutes for messages to come through.

Need more help on configuring that pesky email client? Well try Mail Client, Configuring..

Hey I can't get root's email through IMAP!

This is true, you can't. A good way around this is to redirect root's mail..