# postfix, imap, maildir--imap directory structure

## gustafson

Hi,

I'm wonder what maildir structure need be employed to have imap work.  I set up postfix and when I sent an email to myself the following structure was created:

```
$ ls -lh .maildir/

total 0

drwx------ 2 petegus users  48 2008-06-16 21:07 cur

drwx------ 2 petegus users 112 2008-06-16 21:07 new

drwx------ 2 petegus users  48 2008-06-16 21:07 tmp
```

Unfortunately, trying to setup up imap (kmail) to the account doesn't work.  Squirrelmail doesn't work either and yields the following error message

```
ERROR: Connection dropped by IMAP server.
```

I've looked at many we pages and I don't know how to solve the problem.  I can get the email if I used kmail local maildir account type, but not imap account type.  I'm using courier-imap as the imap service.  Suggestions on where to start?

All mail sent to the account ends up in the "new" directory.

----------

## kashani

Have you installed in imap server? Postfix is an MTA and as such does not supply POP or IMAP. I'd recommend emerging dovecot or courier-imap both of which support .maildir style mail directories. 

kashani

----------

## gustafson

 *kashani wrote:*   

> Have you installed in imap server? Postfix is an MTA and as such does not supply POP or IMAP. I'd recommend emerging dovecot or courier-imap both of which support .maildir style mail directories. 
> 
> kashani

 

Hi Kashini,

Yes, I mentioned that I have courier-imap installed.  (and it is running).  Is there anything I need to do other than that to make courier work?  Is the maildir format above "correct"?  When I connect with kmail disconnected imap, it does connect.  It simply says there are no new messages and shows no directories.

Thanks,

----------

## xtz

What address r u trying to send? If u r sending to user@test.com, check if test.com is a virtual or a local domain. If it's a local domain, it should be listed in the mydestination list in /etc/main.cf. If it's a virtual domain, make sure vmail or whatever u r using have access to the maildir.Last edited by xtz on Tue Jun 17, 2008 2:44 pm; edited 1 time in total

----------

## gustafson

It is a local domain.  #hostname returns test.com.  Mail is delievered to the correct user into the ~/.maildir/new directory.  Postfix recognizes it is a local delivery.

I thought there would be a ~/.maildir/inbox and that it would be delivered there.  Is that not the case?  Thanks,

----------

## depontius

I've set up something similar, except I'm running Dovecot instead of Courier.  In addition, I don't have the maildirs in the home directory, but in a separate spot dedicated for mail.  Both Postfix main.cf and dovecot.conf are set up to point to my mail store.  In my maildir, I have cur, new, and tmp, but no inbox. there is a .INBOX, but inside it are only index and log files, no mail.  I suspect it's kept by Dovecot, not Postfix.  I also have "nested folders" in the maildir, except they're stored as flat paths.  In other words, list/fetchmail and lists/powertop are really stored as .lists.fetchmail and .lists.powertop.  Inside each of those are cur, new, and tmp directories, as well as dovecot index and log files.

----------

## gustafson

I made the switch to dovecot from courier and everything worked fine as you described.  I don't understand why courier is broken.  I'll play around and report a bug if I think it is one.

Thanks,

----------

## tuam

Courier might be picky about the authentication method and the maildir location. Could you post your /etc/courier-imap/imapd and /etc/courier/authlib/authdaemonrc files?

FF,

Daniel

----------

## xtz

 *gustafson wrote:*   

> I made the switch to dovecot from courier and everything worked fine as you described.  I don't understand why courier is broken.  I'll play around and report a bug if I think it is one.
> 
> Thanks,

 Courier is not broken, I'm using both imapd and pop3d over SSL and they work really fine.

----------

## gustafson

Hi xtz, I didn't mean to imply the courier itself was broken, only that my installation was broken.  That is why I wanted to play around before taking further action.  I apologize if it sounded otherwise.

tuam, both  /etc/courier-imap/imapd and /etc/courier/authlib/authdaemonrc are as installed by the ebuild.  I notice in the imapd file that there are several maildirs listed.  Should that mean something?  The last definition appears to be correct.

```
##NAME: MAILDIRPATH:0

#

# MAILDIRPATH - directory name of the maildir directory.

#

MAILDIRPATH=Maildir

# Hardwire a value for ${MAILDIR}

MAILDIR=.maildir

MAILDIRPATH=.maildir

# Put any program for ${PRERUN} here

PRERUN=

# Put any program for ${LOGINRUN} here

# this is for relay-ctrl-allow in 4*

LOGINRUN=
```

Just for kicks I am going to run revdep-rebuild and see what happens.  (Edit: It didn't help)

----------

## tuam

 *gustafson wrote:*   

> tuam, both  /etc/courier-imap/imapd and /etc/courier/authlib/authdaemonrc are as installed by the ebuild. 

 

The point is that a recent update broke my courier, too. It changed from pam to mysql authentication. Unfortunately, I have no access to that box right now, so I can't tell you the exact directive   :Sad: 

FF,

Daniel

----------

## xtz

tuam, before this update, u were using courier-authlib & vpopmail, is that right?

----------

## tuam

I use courier-imap which uses courier-authlib which uses pam. My .maildir is in my $HOME.

FF,

Daniel

----------

