0

I am trying to set up an IMAP server on my basic Centos 7 mail server. I have postfix MTA set up and delivering mails to the following directory (I have no reason to change this to use the $HOME directory):

root@mail3:/var/spool/mail
# ls -ltrh
total 12K
-rw-rw----. 1 rpc    mail    0 Feb 29  2020 rpc
-rw-rw----. 1 centos mail    0 Feb  3 19:39 centos
-rw-rw----. 1 bruce  mail    0 Feb  3 19:47 bruce
-rw-rw----. 1 navid  mail    0 Feb  3 19:47 navid
-rw-rw----. 1 mcchen mail    0 Feb  3 19:47 mcchen
-rw-rw----. 1 rab    mail 9.0K Feb  4 16:44 rab

mailx on the server indicates that mails are stored in /var/spool/mail/%n:

[rab@mail3 ~]$ mailx
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/rab": 5 messages 3 unread
>U  1 robert.mcnaught@gmai  Thu Feb  3 20:23  13/521   "Test 2 with telnet"
 U  2 robert.mcnaught@gmai  Thu Feb  3 20:25  10/453   "Test from edge using telnet"
 U  3 robert.mcnaught@gmai  Thu Feb  3 21:21  10/451   "Test from Telnet Thursday"
    4 Rab McNaught          Fri Feb  4 16:32  75/3885  "Test from Gmail"
    5 Rab McNaught          Fri Feb  4 16:43  75/3902  "Test 3 with local_domains readded"

I have the following configuration (from default) set in dovecot.conf and 10-mail.conf:

# vi dovecot.conf
protocols = imap
login_greeting = Dovecot ready.
listen = *, ::

root@mail3:/etc/dovecot/conf.d
# vi 10-mail.conf 
mail_location = maildir:/var/spool/mail/

I also added global write permissions on /var/spool/mail and mailbox files as I then had an error related to permissions.

I now find that I can login via IMAP and SELECT INBOX, but it produces an empty mailbox, suggesting that it is not picking up my mailbox file in /var/spool/mail/rab

# telnet 0 143
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN] Dovecot ready.
. login rab 1314scoTM
. OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY SPECIAL-USE] Logged in
. select inbox
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 0 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1643997561] UIDs valid
* OK [UIDNEXT 1] Predicted next UID
. OK [READ-WRITE] Select completed (0.004 + 0.000 + 0.003 secs).

Can anyone point me in the right direction with this?

  • https://doc.dovecot.org/configuration_manual/mail_location/mbox/ – AlexD Feb 04 '22 at 17:51
  • Thanks Alex D. I read that the mail mail_location variable was deprecated and have since replaced with maildir. I can now login via IMAP. – user1695543 Feb 04 '22 at 18:03
  • `/var/spool/mail/` isn't a `Maildir`, these files are `mbox` format. The documentation I linked above explains how to work with `mbox` files in `/var/spool/mail/`. – AlexD Feb 04 '22 at 18:31
  • ahh, you are correct. I changed it back to mbox:/var/spool/mail and I can login to IMAP and do IMAP SELECT although it returns 0 mails when I actually have 5 so it is not hitting the mbox file it seems. – user1695543 Feb 04 '22 at 18:35
  • To resolve the empty INBOX via IMAP SELECT, you must specify the INBOX argument in mail_location. I am now using mail_location = mbox:/var/spool/mail/:INBOX=/var/spool/mail/%u – user1695543 Feb 04 '22 at 18:45

0 Answers0