# Imap installation



## dpalme (Nov 15, 2009)

I was considering installing squirrelmail for a browser mail client, but it appears that I will need to ensure that imap is up and running.  Since I have never worked with imap before, is there a specific port that I should be using? I was assuming that it is similar to installing apache, etc.

If I am wrong, some direction would be greatly appreciated.

Douglas


----------



## DutchDaemon (Nov 15, 2009)

There are several IMAP servers in the ports tree. To name a few:
mail/dovecot
mail/cyrus-imapd23
mail/courier-imap
mail/imap-uw

I'm sure each has a following .. I like Dovecot myself. Setting it up is not unlike any other server (like Apache). You decide where it should run (localhost (127.0.0.1:143) would be sufficient for Squirrelmail or Roundcube (mail/roundcube)). The configuration file will usually end up in /usr/local/etc/ of /usr/local/etc/$portname. It shouldn't be too hard to figure out, whichever IMAP port you decide to use. Most will have sensible defaults (a huge number of them even) that you can leave alone, only telling them what IP to listen on.

E.g. Dovecot:


```
protocols = imap
protocol imap {
        listen = 127.0.0.1:143
}
```

Tell Squirrelmail to use 127.0.0.1:143 as well, and you should be off for the most part.


----------



## dennylin93 (Nov 15, 2009)

There are lots of IMAP software available. Just pick one of them. There's mail/dovecot, mail/cyrus-imapd23, mail/courier-imap, and mail/imap-uw. Personally, I prefer Dovecot.


----------



## DutchDaemon (Nov 15, 2009)

It's like I have a twin!

</letterman>


----------



## dpalme (Nov 15, 2009)

Once I have dovecot installed, how do I determine if it is in fact up and running?


----------



## dennylin93 (Nov 15, 2009)

Did you start it yet? If not, put dovecot_enable="YES" in /etc/rc.conf and run `# /usr/local/etc/rc.d/dovecot start`. The config file is located at /usr/local/etc/dovecot.conf.

After that `# sockstat -46l` should show the ports that Dovecot is using.


----------



## dpalme (Nov 15, 2009)

Ok we have a problem.  When I try to run the start command I get the following error:


```
64-150-176-124# /usr/local/etc/rc.d/dovecot start
Error: ssl_cert_file: Can't use /etc/ssl/certs/dovecot.pem: No such file or directory
Fatal: Invalid configuration in /usr/local/etc/dovecot.conf
Error: ssl_cert_file: Can't use /etc/ssl/certs/dovecot.pem: No such file or directory
Fatal: Invalid configuration in /usr/local/etc/dovecot.conf
Error: ssl_cert_file: Can't use /etc/ssl/certs/dovecot.pem: No such file or directory
Fatal: Invalid configuration in /usr/local/etc/dovecot.conf
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...
install: -m: Invalid argument
64-150-176-124#
```

My config file looks like the following:


```
rotocols = imap
   protocol imap {
     listen = 127.0.0.1:143
   }
```


----------



## dennylin93 (Nov 15, 2009)

SSL is enabled by default, so Dovecot will scream if the SSL certificate and key cannot be found. Try (should be around line 90):

```
ssl = no
```

Modify the other parts of the config file as needed (default options are commented out). The Dovecot Wiki is a great place to start. There's also the Quick Configuration.


----------



## dpalme (Nov 15, 2009)

Ok I am getting close now....I think I have everything up and running as far as imap is concerned, and squirrelmail's configtest ran ok.

So I added an alias directive to the /usr/local/apache22/extra/httpd-vhosts.conf file as follows:


```
Alias /webmail/ "/usr/local/www/squirrelmail/"
<Directory "/usr/local/www/squirrelmail">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
```

restarted apache, which was all fine.  However, when I point to http://www.domain.com/webmail I get a 404 not found error.

Am I missing a step? I searched the squirrelmail site but did not find anything that seemed to apply.


----------



## dpalme (Nov 15, 2009)

Nevermind I figured it out


----------

