# postfix + maildir creation

## mcdeck

I've got postfix, courier-imap,  cyrus-sasl and mysql setup following the virtual mailhosting guide. After struggling with the config for about 2 days, I finally got it up and running. 

Still there is a Problem with imap folders. Postfix (I guess?) creates the virtual users maildir on first mail delivery (as mentioned by kashani on some other topics). Nevertheless, only the Inbox and .Trash are created, neither .Sent nor .Drafts. 

So here goes my question: Is anyone aware of a way to tell postfix which directories to create on first delivery? Or do I have to do this 'by hand' (using maildirmake)?

This is quite an issue, because my mail client (namely Mozilla Thunderbird) is unable to send mail through any Imap account as long as there is no 'sent' folder available to store sent mail. It's simply stuck on 'copying sent mail to sent folder' and email is not delivered (I think).

With pop3 it's working perfectly though.

Any hints appreciated. If source hacking will be necessary, I'll do it, as I had to to get cyrus-sasl to work wirh virtual mailing adresses.

TIA

 mcdeck

----------

## kashani

Hmmm I'd suspect that problems creating .Sent and whatnot are more likely to originate from Courier-imap than Postfix. Postfix will create .maildir and then new/ cur/ tmp/ underneath that. That's really all that's required from Postfix's point of view. The imap daemon should handle the usual imap folders.

I'd guess in order of likeliness it's a bug in Thunderbird or something is not quite right in Courier. 

kashani

----------

## mcdeck

So I guess I'll have to trace who is creating which directories .. furhtermore I'll be testing this with outlook (*sigh*) tomorrow. 

I've been browsing the postfix source today and found some make_dir and some other commands .. maybe I'll get the clue tomorrow. 

But for instance, isn't postfix delivering mail to all mailboxes? so shouldn't it be postfix which creates all directories if they don't exists?

----------

## mcdeck

so well, I've been testing this with OE now and it's sending email just like it should, nevertheless, there still is no sent folder. 

And I'd really like this one to be created on first delivery .. *sigh* 

So I guess I'll have to keep on searching  :Smile: 

----------

## jkcunningham

mkdir -p ~/Maildir/newfolder/{new,cur,tmp}

----------

## kashani

 *mcdeck wrote:*   

> So I guess I'll have to trace who is creating which directories .. furhtermore I'll be testing this with outlook (*sigh*) tomorrow. 
> 
> I've been browsing the postfix source today and found some make_dir and some other commands .. maybe I'll get the clue tomorrow. 
> 
> But for instance, isn't postfix delivering mail to all mailboxes? so shouldn't it be postfix which creates all directories if they don't exists?

 

Postfix delivers to .maildir/new and that's it. If the .maildir doesn't exists then it'll create it and the 3 sub folders. As far as I know Postfix will NEVER create a .Sent folder because it has no need for one. Courier on the other hand doing it's IMAP stuff will create other sub dirs which Postfix rightly ignores. Adding emails into the .Sent folder is an IMAP function not a SMTP function.

kashani

----------

## mcdeck

 *jkcunningham wrote:*   

> mkdir -p ~/Maildir/newfolder/{new,cur,tmp}

 

that's quite what maildirmake does, right?  :Smile: 

It's all about I want those directories to be created automatically. (That is, those are created, but as mentioned in my first post, none of those needed by courier imap, besides .trash)

 *kashani wrote:*   

> Postfix delivers to .maildir/new and that's it. If the .maildir doesn't exists then it'll create it and the 3 sub folders. As far as I know Postfix will NEVER create a .Sent folder because it has no need for one. Courier on the other hand doing it's IMAP stuff will create other sub dirs which Postfix rightly ignores. Adding emails into the .Sent folder is an IMAP function not a SMTP function.
> 
> kashani

 

Guess you're right on that. (And thanks for trying to help me, btw  :Smile:  )

So I'm stuck, hm?

No way to get courier or postfix to create these folders? maybe 'ill try to pipe emails through a little shell script or something (like It's done with spamassasin .. ) 

So well, I'll keep on trying ..  :Sad: 

----------

## jkcunningham

I'll reiterate what one of the previous respondants already pointed out: postfix creates maildir directories just fine. That's not your problem.

----------

## nobspangle

I have done a quick check and it seems it is the job of the mail client to create the imap folders.

Outlook and Outlook Express both use a local sent folder and therefore will not create a sent folder. I have squirrelmail installed on my gentoo email box and that does create the sent folders.

I've had a look at thunderbird and I can't see a way to automatically create the folders, however the newest version 0.6 does not hang when it can't find the sent folder, it displays an error and asks if you would like to try again or forget about saving the copy. The message is however sent correctly.

If you want the folders to be created automatically you could create a template in /etc/skel then when you set up a new user the directories are also created.

If you want to use Outlook or Outlook Express, you can change the name of Trash to Deleted Items in /etc/courier-imap/imapd

----------

## mcdeck

You were all right. Excuse my foolishness  :Smile: 

first off:

 *Quote:*   

> If you want the folders to be created automatically you could create a template in /etc/skel then when you set up a new user the directories are also created.

 

I found that on various other topics, but as I've got virtual mailhosting here, with no real accounts at all, that's not really an option, but thanks anyway  :Smile: 

It's in fact the client which is to create the folders. I've integrated this into my admin thingy, so it's working perfectly now. So Thunderbird (still using 0.5) seems kind of broken, but I found an option to have it store sent mail locally. But after all, this is not the desired behaviour for an imap mailbox, is it?

Anyhow, thank you all

Regards

----------

