The following information may have errors; It is not permissible to be read by anyone who has ever met a lawyer. Use is confined to Engineers with more than 370 course hours of electronic engineering for theoretical studies. All content entered becomes and is (C)2007 Transtronics, Inc. the property of Transtronics, Inc. Rest assured that your contributions won't be sold and will be publicly available.
ph +1(785) 841 3089 Email inform@xtronics

IMAP

From Transwiki

Jump to: navigation, search

IMAP - Internet Message Access Protocol

Contents

[edit] dovecot-imapd

If you get an expired cert error -

In order to regenerate the self-signed SSL certificate for dovecot, you have to remove both the old certificate and the old key, and then reconfigure the package dovecot-common.

For example, in a standard installation:

   # rm /etc/ssl/certs/dovecot.pem /etc/ssl/private/dovecot.pem
   #wajig reconfigure dovecot-common

[edit] Debian Centric Setup Notes

  • Stop and remove any old imap daemon.
  • Install dovecot-imapd
wajig install dovecot-imapd
  • You will need to edit /etc/dovecot/dovecot.conf so that the following line reads as follows:
protocols = imaps
  • Start dovecot

Using an imap client - get rid of any subfolders by moving these to the top level (you can recreate these later).

[edit] Moving from mbox to Maildir

While dovecot will keep working with mbox style mail folders, I recommend moving to Maildir for the ability (still sort of beta as of April 2008) to share folders. Sharing folders can be a real productivity boost. There is probably a better way to convert systems with a large number of users.

  • Stop exim, stop dovecot
  • Copy /var/mail/username to /home/username/mail/username.
  • Edit /etc/dovecot/dovecot.conf so it has the following lines (they are at three different places in the file.)
# enables the convert plugin
mail_plugins = convert
#we want to go to a normal Maildir setup
mail_location = maildir:~/Maildir
# We want to convert  from mbox files located in home/mail
convert_mail = mbox:%h/mail
  • Start dovecot (In etch you need to ignore a permissions error)
  • Start each users mail client for 20 sec and then stop them.
  • Wait until there is a file called mail-converted in everyones home directory. (This can take quite a while)
  • Look at /var/log/mail.log for any errors - In etch there is a rename error you should ignore when it is finished.
  • Start up each users MUA and subscribe to the username folder. Move the mail in that folder to the inbox and delete the folder.
  • Fix up Exim - If you are using debconfig, you can just reconfigure to use Maildir. IF you have a hand crafted config you need to change the lines in the local_delivery transport to something like this:
local_delivery:
 driver = appendfile
 group = mail
##next three lines maildir
  maildir_format = true
  directory = /home/${local_part}/Maildir
  create_directory = true
  mode = 0660
  mode_fail_narrower = false
  envelope_to_add = true
  return_path_add = true
  delivery_date_add
## mailbox file = /var/mail/$local_part
  • Startup exim and send some test mails.

[edit] Using dovecot as the LDA

An even better way of having Exim deliver your maildir mail, is to have dovecot act as the LDA(Local Delivery Agent).
  • First edit /etc/dovecot/dovecot.conf to enable the LDA driver. (don't forget to uncomment the end curly bracket)
protocol lda {
# Address to use when sending rejection mails.
postmaster_address = postmaster@example.com                                                                                                                                      

#Hostname to use in various parts of sent mails, eg. in Message-Id.                                                                        
# Default is the system's real hostname.
#hostname =

 # Support for dynamically loadable plugins. mail_plugins is a space separated
 # list of plugins to load.
 #mail_plugins =
mail_plugin_dir = /usr/lib/dovecot/modules/lda

 # Binary to use for sending mails.
 #sendmail_path = /usr/lib/sendmail

 # UNIX socket path to master authentication server to find users.
 #auth_socket_path = /var/run/dovecot/auth-master

# Enabling Sieve plugin for server-side mail filtering
 # mail_plugins = cmusieve                                                                                                          
}
  • Next change exims local delivery
local_delivery_dovecot_maildir:
  driver = pipe
  command = /usr/lib/dovecot/deliver
  message_prefix =
  message_suffix = 
  log_output
  delivery_date_add
  envelope_to_add
  return_path_add
  group = dovecot
  • You may have to change the permissions or owner of dovecot's config file.
chown root.dovecot /etc/dovecot/dovecot.conf
chmod 640 /etc/dovecot/dovecot.conf

[edit] wu-imapd

With the the old wu-imapd package. If you get an expired cert error -

#rm /etc/ssl/certs/imapd.pem
#wajig reconfigure uw-imapd

Keep your old settings and it makes the new cert for you.

Because of the wu-imapd license, I moved on to dovecot a truly GPL package. It turns out it is recommended for use with squirrel-mail.