# procmailrc - Unable to treat as directory (solved)

## carpman

Hello, following guide on setting up home email server. all working and can get email but when i run fetchmail i get following messages:

```

procmail: Error while writing to ".personal/blueyonder"

procmail: Unable to treat as directory ".personal/blueyonder"

```

I did have .maildir created with maildirmake and beleived that other would be created by procmailrc, they were not so manually created them with maildirmake.

The mail is downloaded and put in ~.maildir/new but is not filtered to ~ .maildir/personal/blueyonder

The procmail manual says:

```

 Unable to treat as directory x"

Either the suffix on x would indicate that it should be an MH or maildir folder, or it was listed as an second folder into which to link, but it already exists and is not a directory.

```

but this makes me no wiser as how to fix problem?

procmailrc is:

```

MAILDIR=$HOME/.maildir/

DEFAULT=$MAILDIR

#

## Begin recipes

#

# put cron job emails in my aptly named cron-jobs maildir

:0

* ^Subject:.Cron*

.cron-jobs/

#------------Personal------------------

# Catch all email directed to blueyonder email address:

:0

* ^To:.*me\@blueyonder\.co\.uk

.personal/blueyonder/

```

dir layout

```

michael@caxton ~ $ ls -al .maildir/

total 4

drwx------  6 michael michael  144 Sep 30 13:17 .

drwxr-xr-x  5 michael michael  280 Sep 30 13:22 ..

drwx------  2 michael michael   48 Sep 30 12:18 cur

drwx------  2 michael michael 3744 Sep 30 13:18 new

drwx------  6 michael michael  152 Sep 30 13:18 personal

drwx------  2 michael michael   48 Sep 30 13:18 tmp

michael@caxton ~ $ ls -al .maildir/personal/

total 0

drwx------  6 michael michael 152 Sep 30 13:18 .

drwx------  6 michael michael 144 Sep 30 13:17 ..

drwx------  5 michael michael 120 Sep 30 13:18 blueyonder

drwx------  2 michael michael  48 Sep 30 13:17 cur

drwx------  2 michael michael  48 Sep 30 13:17 new

drwx------  2 michael michael  48 Sep 30 13:17 tmp

michael@caxton ~ $ ls -al .maildir/personal/blueyonder/

total 0

drwx------  5 michael michael 120 Sep 30 13:18 .

drwx------  6 michael michael 152 Sep 30 13:18 ..

drwx------  2 michael michael  48 Sep 30 13:18 cur

drwx------  2 michael michael  48 Sep 30 13:18 new

drwx------  2 michael michael  48 Sep 30 13:18 tmp

```

----------

## magic919

why .personal?

----------

## carpman

 *magic919 wrote:*   

> why .personal?

 

in what context?

If in procmailrc thought you had to start line as such?

Tried renaming personal and personal/blueyonder to hidden dir by adding . so it now .personal/.blueyonder

If why using dir personal, i have a number of personal and bussiness emails and want to filter the appropriatly.

Now procmail complains about 

```

fetchmail:/home/michael/.fetchmailrc:10: syntax error at there

```

----------

## carpman

Dam can't read, fetcmail was getting error, after change to hidden dir it works.

moral of story, when using maildirmake make sure dir and subs dir

```

.dir

.dir/.dir1

```

----------

## carpman

Ok me back again, spoke to soon, although it now work and filter mail to ~ /.maildir/personal/.blueyonder it does not put it the 'new' dir:

```

 ls -al .maildir/.personal/.blueyonder

total 2296

drwx------  5 michael michael  4056 Sep 30 18:48 .

drwx------  6 michael michael   152 Sep 30 18:47 ..

drwx------  2 michael michael    48 Sep 30 18:47 cur

-rw-------  1 michael michael  2296 Sep 30 18:48 msg.-F

-rw-------  1 michael michael  7501 Sep 30 18:48 msg.-H

-rw-------  1 michael michael  3288 Sep 30 18:48 msg.0G

-rw-------  1 michael michael 16592 Sep 30 18:48 msg.0H

-rw-------  1 michael michael  3077 Sep 30 18:48 msg.1F

-rw-------  1 michael michael  5209 Sep 30 18:48 msg.1G

drwx------  2 michael michael    48 Sep 30 18:47 new

drwx------  2 michael michael    48 Sep 30 18:47 tmp

```

As you can see the messages have been filtered but not as expected?

Is there an issue with procmailrc and subdir?

cheers

----------

## magic919

Procmail is fine for this kind of stuff and should be working.  Turn on logging and check.  

```
LOGFILE=$HOME/procmail.log

VERBOSE=yes

LOGABSTRACT=all

```

----------

## carpman

thanks for reply, he is snippit from log, there are lots of these for each email:

```

procmail: [13113] Sat Oct  1 10:54:13 2005

procmail: Assigning "LOGABSTRACT=all"

procmail: Match on "^To:.*me\@blueyonder\.co\.uk"

procmail: Assigning "LASTFOLDER=.personal/.blueyonder/msg.UO"

procmail: Opening ".personal/.blueyonder/msg.UO"

procmail: Acquiring kernel-lock

procmail: Notified comsat: "michael@0:/home/michael/.maildir//.personal/.blueyonder/msg.UO"

```

----------

## magic919

I think your procmailrc is the problem.  I'd drop the trailing slash on the maildir definition.  I notice the double slashes in your logs and that's not right.

----------

## carpman

 *magic919 wrote:*   

> I think your procmailrc is the problem.  I'd drop the trailing slash on the maildir definition.  I notice the double slashes in your logs and that's not right.

 

did as you said about traling / which cured the output in logs but did not change where email went.

Was wondering about this line in the logs

```

procmail: Assigning "LASTFOLDER=.personal/.blueyonder/msg.4b"

```

Is this procmail telling mail to go to last folder as in new went to .personal/.blueyonder/ so it is saying put new email there again?

----------

## carpman

hello, ok just tried setting up another pop account but this time let procmail create maildir,  it created subdir of personal ok but did but did not create the new, tmp cur dir ?

```

ls -al .maildir/.personal/

total 3753

drwx------  6 michael michael     176 Oct  3 18:37 .

drwx------  6 michael michael    1328 Oct  3 18:37 ..

drwx------  5 michael michael    4272 Oct  3 18:36 .blueyonder

-rw-------  1 michael michael 3832443 Oct  3 18:38 .mydomain

drwx------  2 michael michael      48 Sep 30 18:47 cur

drwx------  2 michael michael      48 Sep 30 18:47 new

drwx------  2 michael michael      48 Sep 30 18:47 tmp

 ls -al .maildir/.personal/.mydomain

-rw-------  1 michael michael 3832443 Oct  3 18:38 .maildir/.personal/.mydomain

```

Permissions also are different when procmail creates dir as opposed to manually doing it with maildirmake!

----------

## magic919

Hmm.  I get the same kind of lastfolder thing.  It's in the procmailrc man if you want to check it out.

Paste your current procmailrc and I'll compare to my working ones.

Which IMAP server are you using?

----------

## carpman

 *magic919 wrote:*   

> Hmm.  I get the same kind of lastfolder thing.  It's in the procmailrc man if you want to check it out.
> 
> Paste your current procmailrc and I'll compare to my working ones.
> 
> Which IMAP server are you using?

 

thanks for reply, using courier-imap.

I deleted the maildirmake dir and allowed procmail to create .blueyonder dir, seems allowing procmail to create dir does not work, instead it creates a file and all emails recieved are stored in this file?

i have 'maildir' in USE=

```

MAILDIR=$HOME/.maildir

DEFAULT=$MAILDIR

LOGFILE=$HOME/procmail.log

VERBOSE=yes

LOGABSTRACT=all

#

## Begin recipes

#

# put cron job emails in my aptly named cron-jobs maildir

#:0

#* ^Subject:.Cron*

#.cron-jobs/

#------------Personal------------------

# Catch all email directed to blueyonder email address:

:0

* ^To:.*me\@blueyonder\.co\.uk

.personal/.blueyonder

```

----------

## carpman

Hello, sorted it seem you have add trailing / to end of dir structure:

```

# Catch all email directed to blueyonder email address:

:0

* ^To:.*me\@blueyonder\.co\.uk

.personal/.blueyonder/

```

Note the / after .personal/.blueyonder/

This tells procmail that it needs to create new mail dir which includes new,cur,tmp. New mail now is delivered to correct 'new' dir

----------

## magic919

Glad you got there in the end.  The trailing slash needs to be in some places and not in others, just to add to the fun.  Infinite Ink has helped me through in the past:  http://www.ii.com/internet/robots/procmail/qs/

----------

## carpman

 *magic919 wrote:*   

> Glad you got there in the end.  The trailing slash needs to be in some places and not in others, just to add to the fun.  Infinite Ink has helped me through in the past:  http://www.ii.com/internet/robots/procmail/qs/

 

Yep got it to filter but looks like more than one subdir cannot be read by email clients:

https://forums.gentoo.org/viewtopic-t-388149-highlight-.html

----------

