Closed TopicStart new topicStart Poll

> Imap + Xmail, Linux only
Posted: Nov 7 2004, 05:39 AM
Quote Post


Group: Members
Posts: 428
Member No.: 434
Joined: 21-January 03

I've found a neat IMAP/POP3 server for linux Dovecot. By default it can use CRLF style emails. It can store user info in flat file or a sql style database.

I found this when I was looking for a replacement to courier-imap. Which I do like using alot. But I'm starting to find it harder and harder to mod the new version to work with XMails CRLF style emails.

I've also found I don't have any of those wierd issue with outlook users anymore.

The big problem is that you'll have to configure xmail to run as the user dovecot instead of root (at least for now).

I'll try putting together a write up on how to easly set all this up.

PS. as a side not to couier-imap users. If you want to upgrade to the last version but don't want to mod courier's source. Heres a EZ trick I started to use right before I move to using Dovecot. (Basicly your converting the email to LF and "disabling" Xmails pop3 support and letting Courier handle all your imap/pop service needs)

1. Setup Xmail to use POP3 1110
2. Turn on Courier-imaps POP3
3. Using domain level and Perl setup a script to convert all CRLF to just LR and then put it into a users Maildir/new directory.

If anyone wants a more deltailed way of doing this OR just wants the perl script just let me know.

-- Chris L. Franklin --

All my scripts are written for linux servers.
My XMail scripts
PMEmail PosterUsers WebsiteAOL
Posted: Nov 9 2004, 04:49 PM
Quote Post


Group: Members
Posts: 1
Member No.: 1398
Joined: 9-November 04

"I'll try putting together a write up on how to easly set all this up."

Please do!

(I've tried to install it twice unsuccessfully.)

Thank you.

Posted: Jan 16 2005, 08:09 AM
Quote Post


Group: Members
Posts: 428
Member No.: 434
Joined: 21-January 03

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 !!!)


1. Install Dovecot. (rpm or Source)
From Source :
From RPM :

2. Edit config (my's listed below)

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/

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)

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 :

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

6. Restart Xmail
7. Startup Dovecot

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

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
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
chown -R dovecot.dovecot *

6. Startup Xmail as so :
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 :

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

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

-- Chris L. Franklin --

All my scripts are written for linux servers.
My XMail scripts
PMEmail PosterUsers WebsiteAOL
Posted: Jan 16 2005, 10:44 AM
Quote Post

No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 1776
Member No.: 427
Joined: 18-January 03

Thank you for the contrib.



All electric machines work on smoke...when the smoke escape from machines, they don't work anymore
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming or what?"
PMEmail PosterUsers WebsiteICQ
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Documentation and Knowledge Base | Next Newest »

Closed TopicStart new topicStart Poll