#----------------------------------------------------------------
#	This file explain how to set Clement in local mode
#	(storing E-mail locally) and the dovecot configuration
#	to read E-mail.
#----------------------------------------------------------------
#----------------------------------------------------------------

1. Dovecote configuration add-on

   You need to add following line with the file /etc/dovecot.conf
   (Usually entries are commented out, just set proper value and
    comment in)
   
  passdb passwd-file {
    # Path for passwd-file
    args = /var/spool/clement-2.1/mails/%d/.passwd
    }

  userdb static {
    # Template for settings. Can return anything a userdb could normally
    # return, eg.: uid, gid, home, mail, nice
    #
    # A few examples:
    #
    #  args = uid=500 gid=500 home=/var/mail/%u
    #  args = uid=500 gid=500 home=/home/%u mail=mbox:/home/%u/mail nice=10
    #
    #- Caution mail UID is below first_valid_uid, you may need to
    #- change it in your current implementation
    args = uid=mail gid=mail mail=mbox:/var/spool/clement-2.1/mails/%d/%n
  }


2. .passwd file structure

   .passwd must have the same structure as you /etc/passwd file.

   Beware: userid within .passwd do NOT include the domain information,
           domain information is deducted from directory name.
	   such user "test@mylocal.dom" will be known as
	   "test" in spool/mails/mylocal.dom/.passwd file.

    
    Bellow is an extract of .passwd file
    
    test0:$1$ZBzOXoE2$d2qx1ddnE/mReJbCEZW201:999:999:::
    test1:$1$ZBzOOXoE2$d4qx1ddnE/mReJbCEZW201:999:999:::
    test2:$1$ZBzOOXoE2$d7qx1ddnE/mReJbCEZW201:999:999:::
    test3:$1$ZBzOOXoE2$d8qx1ddnE/mReJbCEZW201:999:999:::

    999:999 are UID and GID, need to be set but value
    itself are not meaningfull.

    You must have a .passwd in each domain directory you
    have created.
#----------------------------------------------------------------
3. Modifying dovecot to provide pop_before_smtp IP list

   Dovecot configuration can be modified to allow relayed
   IP number 'on the fly'. To do such, dovecot need to call
   a clement program named popimap everytime a user access
   dovecot to retrieve E-mail.

   Find within the dovecot configuration file BOTH the
   protocol POP3 and protocol IMAP directive.
   Change entry mail_executable to be

   mail_executable = /usr/bin/pibsmtp /usr/libexec/dovecot/pop3

   A file named 'pibsmtp.lst' will be updated everytime a dovecot
   access will be successful, file is stored within directory
   '/etc/clement-2.1'.
   This file 'pibsmtp.lst' will be used by Clement to generate
   a file named 'poprelay' formated as "IP/MASK" to be used
   by clement as a relayable list of IP.
#----------------------------------------------------------------
