Skip to main content

We have an existing email infrastructure running uw-imapd and exim4 on Debian GNU/Linux Etch and needed to hook up a Nokia E71 mobile telephone to this existing setup.

The existing infrastructure has run without issue for many years. However the E71 would take a minute or so to retrieve just a single email. Therefore some alternatives were tried.

Firstly courier-imapd was tried. This resulted in many complete lock-ups of the E71. The battery had to be removed to restore the E71 back to life. This did indicate that the issues with collecting email using IMAP probably lay with the telephone rather than the server.

Secondly dovecot-imapd was installed and tested. After some tweaking, acceptable results were achieved. Reasonable compatibility with the legacy uw-imapd software was maintained and performance overall was noticeably improved. The software migration steps are detailed below.

  1. Create a directory for Dovecot's indexes.
    mkdir -p /var/local/indexes/dovecot
    chmod 777 /var/local/indexes/dovecot
    chmod o+t /var/local/indexes/dovecot
  2. Disable IMAP network access. There is no need to run the ip6tables commands if IPv6 is not in use.
    iptables -I INPUT -p tcp --sport imap -j REJECT
    iptables -I INPUT -p tcp --sport imaps -j REJECT
    ip6tables -I INPUT -p tcp --sport imap -j REJECT
    ip6tables -I INPUT -p tcp --sport imaps -j REJECT
  3. Dovecot does not include the contents of the user's mailbox in the inbox it presents to the clients, so migrate existing messages from ~/mbox to /var/spool/.
    mutt -f /home/xxx/mbox
    tag each message using t and then bulk move all these tagged messages.
  4. Re-generate the mailbox subscriptions.
    cd /home/xxx/mail
    echo INBOX >.subscriptions
    find >>.subscriptions
    chown xxx:xxx .subscriptions
    vi .subscriptions
    remove ., ./.subscriptions, and leading ./'s
  5. The E71 has difficulty in keeping track of which mailboxes have new messages. As a result when you subscribe to a folder other than the inbox the telephone will no longer alert you of any new emails. To remedy this, do the following. Search all mailboxes of all users for messages with this subject.
    Remove these messages completely.
  6. De-install uw-imapd and install dovecot-imapd.
    aptitude remove uw-imapd
    aptitude install dovecat-imapd
    Dovecot should be disabled by default, but stop it anyway just in case.
    /etc/init.d/dovecot stop
  7. Re-configure Squirrel Webmail
    vi /etc/squirrelmail/config.php
    $default_folder_prefix          = '';
    cd /var/lib/squirrelmail/data
    vi *.pref
  8. Re-configure all other mail clients. Since the mail folder has changed from being mail/ to not being needed at all, references to mail/ need to be removed. All mail folders are now at the top level alongside the inbox.
  9. Now configure Dovecot.
    vi /etc/dovecot/dovecot.conf
    protocols = imap imaps
    listen = [::]
    ssl_key_file = /etc/ssl/certs/imapd.pem
    ssl_cert_file = /etc/ssl/certs/imapd.pem
    mail_location = mbox:~/mail:INBOX=/var/mail/%u:INDEX=/var/local/indexes/dovecot/%u
    mail_privileged_group = mail
    Restart the Dovecot service.
    /etc/init.d/dovecot restart
  10. Re-enable IMAP network access.
    iptables -D INPUT -p tcp --sport imap -j REJECT
    iptables -D INPUT -p tcp --sport imaps -j REJECT
    ip6tables -D INPUT -p tcp --sport imap -j REJECT
    ip6tables -D INPUT -p tcp --sport imaps -j REJECT