Installing and setting up Dovecot in Red Hat Enterprise Linux 5 or CentOS 5 is easy. All we have to do is to enable the services we would like to provide and we are good to go.
Install Dovecot

1. If you did not add dovecot during the CentOS installation, you can add it now using Package Manager.Configure Dovecot

1. Click Applications, select System Tools then click File Browser. This will launch the File Browser window.
2. In the Location field, type in /etc and press Enter. If you don’t see the Location field, click the notepad button to toggle to text-based location bar.Find the following keys and change its values as follows
protocols = pop3 pop3s imap imaps mail_location = maildir:~/Maildir/ pop3_uidl_format = %08Xu%08Xv imap_client_workarounds = delay-newmail outlook-idle netscape-eoh pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
For 64-bit users: Add the line login_process_size = 64 in the file /etc/dovecot.conf.
Lines starting with # are comments. The last two line enables workarounds for various client bugs. Save the file after completing your changes.

4. Start the dovecot service. Learn how to start and stop services here.Test Dovecot

1. Click Applications, select Accessories, and click Terminal. This will launch the Terminal window.Sample dovecot session. Replace johndoe and password with any valid user name and password.
[root@mail ~]# telnet localhost pop3 +OK dovecot ready. user johndoe +OK pass password +OK Logged in. list +OK 1 messages: 1 622 . retr 1 +OK 622 octets Return-Path: <johndoe@mail.acme.local> X-Original-To: johndoe Delivered-To: johndoe@mail.acme.local Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by mail.acme.local (Postfix) with SMTP id 9729067C17 for <johndoe>; Thu, 22 Feb 2007 09:06:37 -0500 (EST) Message-Id: <20070222140640.9729067C17@mail.acme.local> Date: Thu, 22 Feb 2007 09:06:37 -0500 (EST) From: johndoe@mail.acme.local To: undisclosed-recipients:; X-IMAPbase: 1172153557 1 Status: O X-UID: 1 Content-Length: 5 X-Keywords: test . quit +OK Logging out. Connection closed by foreign host. [root@mail ~]#
If you encounter any problems, check the log file at /var/log/maillog.
«« Previous: How to Setup Postfix SMTP Server
Next: How to Setup SMTP Auth »»
***
Posted on 4/23/2007 and last updated on 7/12/2008
Filed under CentOS 5 , Dovecot , Red Hat Enterprise Linux 5
Share This


January 12th, 2008 at 12:50 am
on centos5, i don’t have
/var/spool/log/maillog
i have
/var/log/maillog
January 12th, 2008 at 1:08 am
You’re right. Even centos4 uses /var/log/maillog. I don’t know where I got /var/spool/log/maillog. I’ve corrected the text, thank you very much for pointing that out.
January 29th, 2008 at 6:14 am
plese tell how to configure dovecot service in rhel 5 step by step
January 29th, 2008 at 12:05 pm
Hi,
You’re reading it already
The same instructions above works with RHEL 5, CentOS 5 is based on RHEL 5. Unless you need more details, but I suggest you try the above first, the instructions are already very detailed.
March 18th, 2008 at 7:34 pm
I have dovecot and postfix running. did this pop3 session and get an error. The loging take place fine than immediatly disconnects.
Trying 127.0.0.1…
Connected to localhost.localdomain (127.0.0.1).
Escape character is ‘^]’.
+OK Dovecot ready.
user username
+OK
pass password
+OK Logged in.
Connection closed by foreign host.
Mar 18 15:10:09 localhost dovecot: POP3(username): Unknown client workaround: outlook-on-nuls
Mar 18 15:10:09 localhost dovecot: pop3-login: Login: user=, method=PLAIN, rip=::ffff:127.0.0.1, lip=::ffff:127.0.0.1, secured
Mar 18 15:10:09 localhost dovecot: child 6913 (pop3) returned error 89
Some help would be great.
March 18th, 2008 at 9:26 pm
In dovecot.conf, the line should be
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh but you specified outlook-on-nuls instead.
March 18th, 2008 at 10:49 pm
Great, that was the problem. thanks very much.
April 7th, 2008 at 10:24 pm
Hi all,
I’ve gone through all these details and can send mail from the server using the terminal window, to other accounts on the server.
How do I set it up to use a domain name? So, I want to be able to have my friend send an email to me@mydomain.com and have my server pick it up and send it to a particular user on my server.
April 17th, 2008 at 12:55 am
Hi,
I’ve set up my test server for imap, but when I “telnet localhost imap” no matter what i type i get the following error:
telnet localhost imap
Trying 127.0.0.1…
Connected to localhost.localdomain (127.0.0.1).
Escape character is ‘^]’.
* OK Dovecot ready.
user
user BAD Error in IMAP command received by server.
any ideas?
April 17th, 2008 at 4:20 am
That’s because IMAP has a different set of commands from POP3. I’m not familiar with IMAP commands and I suggest you use a mail client to test IMAP.
April 17th, 2008 at 11:13 am
Thanks, and I have googled on the imap commands but still have not had any luck. I will try an email client and see what happens. Great informational website by the way
April 18th, 2008 at 12:45 am
Hi again,
I’m now stuck. I have successfully got dovecot working with pop3 and pop3s on both Outlook and Thunderbird. The problem I am having is with imap.
If I use either imap or imaps with Thunderbird it works fine, but Outlook just keeps prompting for my password and will go no further. All i see is authentication errors in the logs when trying outlook with imap. What do I have to do to get Outlook working with imap?? Thunderbird works like a champ!
April 18th, 2008 at 2:33 pm
You probably did not include the line below in your dovecot.conf
imap_client_workarounds = delay-newmail outlook-idle netscape-eoh
The important setting above is the outlook-idle. A workaround specifically for Outlook.
April 18th, 2008 at 2:37 pm
Thanks, but I have that complete line in there. I believe my problem has something to do with Outlook wanting to use NTLM for authentication but I may be mistaken. Either way I’ve found nothing on the web to solve this, but I’m sure someone out there must be using an imap/dovecot/outlook working combination.
April 18th, 2008 at 2:58 pm
I’m pretty sure that is the problem. I was able to replicate your problem by removing the line above. You can verify if that is indeed your problem by checking /var/log/maillog. Mine had the line
dovecot: imap-login: Disconnected: Inactivity
If your log has the line above, make sure that the imap_client_workarounds is inside the protocol imap section like this
protocol imap {
imap_client_workarounds = delay-newmail outlook-idle netscape-eoh
}
April 18th, 2008 at 3:09 pm
Is that line order specific as I have outlook-idle first and the line is at the bottom of the imap stanza. I have made the changes per above and moved that line to the top of the stanza.
Anyway, I will verify the above when I get home later this evening and post back. I appreciate the help, thanks a lot
April 18th, 2008 at 3:15 pm
Also, i see this in the /var/log/maillog and you may be right
if the line is order specific and should be at the top
imap-login: Disconnected: Inactivity: rip=::ffff:192.168.x.x, lip=::ffff:192.168.x.x, TLS
imap-login: Disconnected: Inactivity: user=, method=PLAIN, rip=::ffff:192.168.x.x, lip=::ffff:192.168.x.x, TLS
Apr 17 17:41:33 dovecot: imap-login: Disconnected: user=, method=PLAIN, rip=::ffff:192.168.x.x, lip=::ffff:192.168.x.x, TLS
April 18th, 2008 at 4:45 pm
Hmm… You’re right, you do have imap_client_workarounds. Next question, did you setup TLS? If not, then uncheck This server requires an encrypted connection (SSL) in your Outlook email settings.
April 21st, 2008 at 12:15 pm
Well, I’ve come to the conclusion that something in Outlook is corrupt. I have since installed and configured both Outlook Express and Eudora. Both programs work fine with imap and imaps.
I guess I’ll uninstall Outlook next and clean it up best I can then re-install and try again. Since imap and imaps work with everything else, I’m pretty sure it’s not a server config issue.
April 23rd, 2008 at 5:37 pm
A note for using 64-bit CentOS 5 or RHEL:
dovecot: imap-login: imap-login: error while loading shared libraries: libsepol.so.1: failed to map segment from shared object: Cannot allocate memory
dovecot: pop3-login: pop3-login: error while loading shared libraries: libsepol.so.1: failed to map segment from shared object: Cannot allocate memory
If you start dovecot, the main dovecot daemon will run with one auth child process, but there will be no POP/IMAP processes started. To fix the issue, open the /etc/dovecot.conf and adjust the following directive:
login_process_size = 64
Restart dovecot after making the change:
# /etc/init.d/dovecot restart
April 23rd, 2008 at 9:07 pm
You’re right. I have that instruction on my Update CentOS 5.0 to 5.1 page and I forgot to put it here for those using 5.1 from the very start. I’ve updated the text above, thanks.
May 5th, 2008 at 12:42 pm
Can I use this Dovecot for smtp authentication? What users users shall I use for smtp authentication? Last one, How do I create users with domain names with them???
As in test@mail.server.info??
May 5th, 2008 at 12:51 pm
Yes, see Postfix SMTP Authentication and Dovecot SASL. By default it uses the Linux system user accounts. The domain name used will be the one you specified in Postfix.
May 6th, 2008 at 7:01 am
I use dovecot with squirrelmail and use linux system accounts with MAILDIR . When I login in through squirrelmail two times form the same machine(client) with two different login ID’s the mailbox of the later (login user) is fetched by dovecot for both the the accounts ie if I try to access the first login users mailbox the second user mail box is shown .
output of dovecot -n is
1.0.5: /etc/dovecot.conf
log_path: /var/log/dovecot
protocols: imap imaps
login_dir: /var/run/dovecot/login
login_executable: /usr/libexec/dovecot/imap-login
mail_location: maildir:~/Maildir
auth default:
passdb:
driver: pam
userdb:
driver: passwd
…..
out put of the Dovecot log is
dovecot: May 05 18:49:48 Info: imap-login: Login: user=, method=PLAIN, rip=::ffff:127.0.0.1, lip=::ffff:127.0.0.1, secured
dovecot: May 05 18:49:48 Info: IMAP(ath): Disconnected: Logged out
I noticed too many such messages for a single login
May 7th, 2008 at 7:59 pm
Hi, I’v followed this steps and the SMTP installation steps, I’m using the Centos 5, but I can’t see my messages, when I type ‘list’, it responses me 0 messages, but, when I look to my mail box file, it have about 6 messages, can you help me?
sets for /etc/postfix/main.cf :
home_mailbox = Maildir/
this stores in a file named by username (eg.: thiago) at folder /var/spool/mail
so it uses /var/spool/mail/thiago file
sets for /etc/dovecot.conf :
mail_location = maildir:~/Maildir/
May 7th, 2008 at 8:03 pm
Correction, the Postfix service is using a symbolic link that point real path folder /var/spool/mail to /var/mail
May 7th, 2008 at 11:06 pm
Please comment out all mail_spool_directory lines in /etc/postfix/main.cf. It overruled the home_mailbox settings. Your mails should be saved in /home/user/Maildir.
May 9th, 2008 at 11:11 pm
Ok, I’ll insert exactly /home/user/Maildir or /home/%username%/%Maildir% ??
(Where words that start/end with % means variables).
May 10th, 2008 at 1:01 am
See Postfix SMTP Server Setup Howto for more details in configuring and testing Postfix.
July 7th, 2008 at 9:12 pm
Hi,
I have been having problems with upgrading to dovecot 1.0 or higher from the .99 version which doesn’t like the maildir field.
Is there a way to find out exactly how to do the upgrade to the original folder/files that the .99 version is using to run?
I am new to this and have had nothing but problems.
July 7th, 2008 at 10:40 pm
How dovecot .99 and 1.0 reads the mailbox folder/files is the same. The only problem is that the configuration file of 1.0 is so much different from .99 I think you just need to replace your 0.99 configuration file with the new 1.0 file.
July 8th, 2008 at 1:26 pm
Thanks so much for your reply, but do you know if the dovecot program files like the ones it uses to “work”? Like its systems files let’s say…?
Like for example, when you run the upgrade from .99 or 1.0 and you get the rpm and you set it up in /usr/local/etc or else and it is different than the one that the initial CentOS installation puts the files/system folders originally…
Let me know if you have any suggestions/comments, thanks a lot for you help, your guide is outstanding!
October 30th, 2008 at 3:17 pm
OS: Centos 5.2
I’ve followed your steps and I got
[root@tuah ~]# telnet localhost pop3
Trying 127.0.0.1…
Connected to localhost.localdomain (127.0.0.1).
Escape character is ‘^]’.
+OK Dovecot ready.
user mdlan
+OK
pass mypassword
+OK Logged in.
Connection closed by foreign host.
Below is last 3 lines of maillog files
Oct 31 07:12:10 tuah dovecot: chdir(/home/mdlan) failed with uid 500: Permission denied
Oct 31 07:12:10 tuah dovecot: pop3-login: Login: user=, method=PLAIN, rip=::ffff:127.0.0.1, lip=::ffff:127.0.0.1, secured
Oct 31 07:12:10 tuah dovecot: child 18770 (pop3) returned error 89
Looking forward your help
Thanks
October 30th, 2008 at 10:33 pm
1. Does /home/mdlan exists? If you create a new user, you should include its home directory.
2. Does mdlan have a uid of 500? If not, you probably mixed in the virtual user configuration which uses its own UID
3. Is /home/mdlan owned by uid 500?
October 31st, 2008 at 7:32 am
thank for the reply.
I created another user and the result was as supposed to be.
thanks again