# Postfix, fetchmail, procmail and maildir - folder problems

## lcn

At home I have a 2 system setup: One system (old, 300 Mhz) running Gentoo, and being used as mailserver, the other newer mainly used for regular use, switching between Gentoo and Windows XP.

On system 1 I have installed: Postfix, Courier-Imap, fetchmail and procmail.

The fetchmailrc is:

```
# Configuration created Mon Jan 27 18:08:38 2003 by fetchmailconf

set postmaster "postmaster"

set bouncemail

set no spambounce

set properties ""

set daemon 120

poll mail.brabant.chello.nl with proto POP3

       user 'l.noordhuizen' there with password 'geheim' is 'leozelf' here options keep

```

The procmailrc:

```
MAILDIR=/home/lcn/.maildir

DEFAULT=$MAILDIR/.new/

LOGFILE=$MAILDIR/from

LOG="

"

:0

* ^Subject:.*gentoo

$MAILDIR/.Computing.Gentoo/

:0

* ^Subject:.*shoptalk

$MAILDIR/.Golf.Shoptalk/

:0

* ^From:.*t\.vandenbout

$MAILDIR/.Personen.Lex/

```

Example of the logging from procmail:

 *Quote:*   

> From gentoo-user-return-7566-leo=noordhuizen.net@gentoo.org  Tue Feb 11 06:44:11 2003
> 
>  Subject: [gentoo-user] Switching from PS/2 to USB mouse
> 
>   Folder: /home/lcn/.maildir/.Computing.Gentoo/new/1044942251.20412_0.	   2689
> ...

 

There are a number of things I do not understand, and I have been trying quite a number of permutations.

In general the mail seems to be delivered in a correct way, and even in the correct directories; however In the various mail clients I tried, I see that new messages are available, but when trying to access the folder, they are not shown, and the number of new messages indicated, is reset to zero.

When I try to access the folders with Squirrelmail I get PHP errors.

I am quite sure that I have messed up the information in the directories in ~lcn/.maildir, however I do not understand what caused that, and I also do not have a clue how to correct it.

In addition I do not understand the message in the logging, indicating that there is an error writing to the logging file   :Surprised:  .

So in other words: I am lost.

----------

## slartibartfasz

i guess u compiled with USE="maildir -mbox" ... to get maildir support in your system...? [blind shot]

----------

## lcn

I understood that maildir format was default with gentoo.

To be sure I am re-emerging all part after including the 'maildir' and  '-mbox' USE parameters.

In addition I remade the directory structure.

I will come back with the results...

----------

## lcn

Everything looked fine.....

However  :Evil or Very Mad:  : I created with squirrelmail the folders (beneath Inbox) Computing, and beneath Computing Gentoo.

This resulted in the seemingly correct directory structure in .maildir: directories .Computing and .Computing.Gentoo with correct subdirectories.

Started fetchmail: with same configuration as in the beginning. Again errors concerning the log, however the log is written. And ... the messages are put in the correct subdirectory cur, but are not readable.

In squirrelmail I get errormessages like:

 *Quote:*   

> Unknown response from IMAP server: 1.* NO cannot open message 1

 

So... my problem is NOT solved yet. I'm flabbergasted....

----------

## dsegel

This may be way off base, but some imap mail clients won't work with uppercase directory names. Try changing 'Computing' to 'computing' and see if that helps.

Also, check the permissions on the directories and maybe you need a trailing / after 'from' for procmail?

- Daniel

----------

## lcn

I am thinking of giving up. (But not planning to   :Laughing:  )

As I am keeping my emails on the server during the experiments, and processing my email via Outlook Express on XP, I am not really in a hurry, but am only getting p'd off.

I did everything what was suggested: re-emerged the relevant tools, scratched the complete maildir tree and restarted.

My conclusion is, that procmail does not write the correct (Courier Imap compatible) maildir format.  I cannot find a description of the Courier flavor (flavour ?) of the maildir structure, but only after having procmail write messages in subsub folders (eg .Computing.Gentoo)  things are seriously messed up. After that no mailclient can read messages from the folder any more.

Does anybody have any suggestions ? Should I forget about the nice (?) IMAP setup ? Any alternatives ? HELP !    :Confused: 

I cannot imagine that I am the only one having these challenges.

----------

## slartibartfasz

yeah setting up mail can really be a pain in the ass - there are a lot of different opinions about what people think is a easy manageable mail-setup. when i set up my mailserver i tried serveral progs for several months and settled then with qmail+plugins and mailman - just try to see what u like   :Cool:   (its a really great feeling when everythings working in the end...)

----------

## NineMinuteNap

I'm using an almost identical setup, with the exception of using getmail rather than fetchmail.  I could be wrong, but I'm not aware of different versions of the maildir format, so Courier-IMAP may not be the problem.

The first thing to grab my attention from your .procmailrc is:

```
DEFAULT=$MAILDIR/.new/
```

Try dropping '.new/' from the end of that line.  As I understand it (and from my [limited] experience), messages are delivered to the mail directory as a whole and linked/copied from the 'tmp' directory to the 'new' directory for new messages, then unlinked/moved to 'cur' once they've been read.  Hopefully someone else can expand and/or correct that information.

Also, try adding a slash on the end of your maildir definition:

```
MAILDIR=/home/lcn/.maildir/
```

As for creating maildir's, try the maildirmake command.  I was trying to build them manually and they never seemed to work right.  I don't know how many times I wiped out my ~/.maildir and started over again while getting everything set up, but it seemed easier once I learned about maildirmake.

I made some new (nested) mail directories with Sylpheed, then opened Squirrelmail to see if they'd work.  They seemed to work until I tried to rename them with capital letters (thanks for the tip, dsegel).  I tried Evolution and Mutt and they both saw the directories named with capital letters.  Have you tried other email clients besides Squirrelmail to test your setup?

I only recently discovered imap, and one of the reasons I was determined to get my own mailserver up and running is because the 'real' mailserver I use is POP3 only.  Don't give up yet!

----------

## Gav

Just to try and add some more useful information to this thread... Details of the maildirmake command can be found here. Of interest to what I've read in this thread is the folder option, to create sub-sub...

I've been having some problems with my Email setup as well and think it's down to maildir. One thing I haven't tried is running maildirmake as the real user whose account it is (mine - I tend to run root as I'm the only real user).

I hope this helps someone  :Very Happy: 

----------

