Posted by Steve on Thu 20 Oct 2005 at 11:33
This brief introduction to setting up an IMAP mailserver. The big attraction of using an IMAP mail-server is that all folders, and state, is persisted upon the server side. So if you login to check your mail from multiple locations you always have the same view of it.
Once you have the IMAP server running you can setup webmail to allow you to check your mailboxes without having to setup a client - or access your mail when you're on the move.
Dovecot is a reatively new server, but it has proven both small, fast, and reliable. It offers both an IMAP server component and a POP3 server. Here we'll only be covering the former.
Installing the package is simple enough. Simply run:
apt-get install dovecot-imapd
Once installed you'll be able to configure the server by means of the files in the directory /etc/dovecot/.
The main configuration file we will touch is the file /etc/dovecot/dovecot.conf. Firstly we need to enable the IMAP server by changing the default lines:
# Protocols we want to be serving: # imap imaps pop3 pop3s protocols =
As we only care about IMAP here, rather than POP3, we can set:
# Protocols we want to be serving: # imap imaps pop3 pop3s protocols = imap imaps
If you have special needs you can also choose to allow the server to only listen upon a specific address. (For my needs I wish to later install Webmail, so I don't wish to make the server publically available). As an example you can cause the server to only listen upon the loopback address with:
# IP or host address where to listen in for connections. It's not currently # possible to specify multiple addresses. "*" listens in all IPv4 interfaces. # "[::]" listens in all IPv6 interfaces, but may also listen in all IPv4 # interfaces depending on the operating system. You can specify ports with # "host:port". imap_listen = localhost #pop3_listen = * # IP or host address where to listen in for SSL connections. Defaults # to above non-SSL equilevants if not specified. imaps_listen = localhost #pop3s_listen =
The next thing you'll need to do is tell dovecot where it can find the mailboxes for the local users. Here you have several options, and which you choose will depend upon the mail setup you have upon your host.
For my servers I tend to use the mbox mail-store - where each user has a directory ~/Mail containing a file for each of their mailboxes.
If you have the same setup you can use the following configuration:
default_mail_env = mbox:~/Mail/
The other options are discussed in the configuration file as this section of the configuration file shows:
# Default MAIL environment to use when it's not set. By leaving this empty # dovecot tries to do some automatic detection as described in # /usr/share/doc/dovecot-common/mail-storages.txt. There's a few special # variables you can use: # # %u - username # %n - user part in user@domain, same as %u if there's no domain # %d - domain part in user@domain, empty if user there's no domain # %h - home directory # # You can also limit a width of string by giving the number of max. characters # after the '%' character. For example %1u gives the first character of # username. Some examples: # # default_mail_env = maildir:/var/mail/%1u/%u/Maildir # default_mail_env = mbox:~/mail/:INBOX=/var/mail/%u # default_mail_env = mbox:/var/mail/%d/%n/:INDEX=/var/indexes/%d/%n #
With these changes made we can now restart the server, and cause the IMAP server to run:
/etc/init.d/dovecot stop /etc/init.d/dovecot start
Once the server is started you can use any IMAP-capable mail client to test that things are working. mutt is a good choice if you're testing on a loopback installation.
Simply run:
mutt -f imap://username@localhost/folder
Once mutt has prompted you for your password you should see your selected folder.
If the test succeeds you can now go on to setup webmail with SuirrelMail.
Interesting comment, thanks. I can see how shared access would be very useful for some jobs - such as a shared "support" mailbox for example.
I guess we'll just have to wait for it to become stable and then released. I'm sure that apt-get.org, or the backports site will carry it when it's ready.
Steve
--
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
# Location for users' mailboxes. This is the same as the old default_mail_env # setting. The default is empty, which means that Dovecot tries to find the # mailboxes automatically. This won't work if the user doesn't have any mail # yet, so you should explicitly tell Dovecot the full location.
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]