OK I finally found time to write this. (this is for dovecot 99.X)

(in dovecot 1.0 it'll able to auth against Xmail via a auth script. aka You'll only need to have 1 user account databases, XMAIL's YAY !!!)

Steps:

1. Install Dovecot. (rpm or Source)
From Source : http://wiki.dovecot.org/CompilingSource
From RPM : http://wiki.dovecot.org/PrebuiltBinaries

2. Edit config (my's listed below)
CODE

base_dir = /var/run/dovecot/
imap_listen = *
pop3_listen = *
info_log_path = /var/log/dovecot
login_dir = /var/run/dovecot/login
login = imap
login_executable = /usr/libexec/dovecot/imap-login
login = pop3
pop3_executable = /usr/libexec/dovecot/pop3
verbose_ssl = no
default_mail_env = /var/MailRoot/domains/%d/%n/Maildir
mail_cache_fields = Envelope MessagePart
client_workarounds =  outlook-idle
mailbox_check_interval = 5
mailbox_idle_check_interval = 30
maildir_stat_dirs = no
maildir_copy_with_hardlinks = no
maildir_check_content_changes = yes
auth_mechanisms = plain
auth_userdb = static uid=97 gid=97 home=/var/MailRoot/domains/%d/%n/Maildir
auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@
auth_passdb = passwd-file /var/MailRoot/dovecotusers.tab


3. Give Dovecot permission to the domains dir under MailRoot
I used acls to do this so that Xmail can still run as root and Dovecot could still run as a non-root user. (if you rather not do this your other option is tp run xmail as the same user a dovecot See non-Acls below)
CODE

setfact -R -m d:u:dovecot:rwx,d:g:dovecot:rwx;d:o:---,d:m:rwx /var/MailRoot/domains
setfacl -R -m u:dovecot:rwx,g:dovecot:rwx;o:---,m:rwx /var/MailRoot/domains


4. Set Xmail to listen on another port then 110 for pop3.
Add "-Pp 20110 " to xmail startup options.

5. Setup User Accounts.
As of 99.X of dovecot it doesn't support using a external script to check user acount info (user/password). So it needs a place to have it's own useraccount storage place.

For more ways dovecot can store user info see : http://wiki.dovecot.org/Authentication

I use " passwd-file /var/MailRoot/dovecotusers.tab" and create it from a modified xmail2smapost script called xmail2dovecot. (See xmail2dovecot below)

6. Restart Xmail
7. Startup Dovecot


Non-Acls:
To allow Xmail to so it's thing + Allow dovecot Access to XMails MailRoot. You'll need to run Xmail as the user Dovecot runs at. I found after some trial and error that is pretty easy.

What you'll need.
1. Iptables
2. su

Setup
1. Disable Xmail from starting at boot.
2. Stop Xmail
3. edit the user dovecot and chnage there shell to /bin/bash
4. Create a IPtables rule to route port 25 to 20025
Example:
CODE
iptables -t nat -A PREROUTING -p tcp --dport 25 -j REDIRECT --to-port 20025

5. Change permissions in MailRoot from root.root to dovecot.dovecot
CODE
chown -R dovecot.dovecot *

6. Startup Xmail as so :
CODE
su - dovecot -c "/var/MailRoot/bin/XMail -Mr 24 -Pl -Ph -Sl -Ql -Yi 30 -Yl -Fl -Cl -Ll -PX 0 -Sp 20025 -Pp 20110 -Fp 20079 -Ms /var/MailRoot"


XMail2Dovecot Script
This a script that was Org. used with smartpost. And was called xmail2smartpost.php But I changed it to output All the user account info into a simple passwd/Shadow. (user@domain:MD5-password)

Download From : http://xmail.nomadcf.com/info.php?program=xmail2dovecot

After Downloading it , extract it to the MailRoot/bin/ and then edit it.
And lastly Run it as like so :
CODE

cd /var/MailRoot/bin/
./xmail2dovecot.php > ../dovecotusers.tab


--------------------
-- Chris L. Franklin --
www.NomadCF.com