IMAP folders they do not create

hockolicious

Verified User
Joined
Jun 20, 2019
Messages
70
Location
Poland
Hello,

I have big, big issue with IMAP folder they do not create by default. I search forum and I found some topic with similar problem- https://forum.directadmin.com/showthread.php?t=54713

And now I do step, by step with no effect.

First create a file 90-special-folders.conf in /usr/local/directadmin/custombuild/configure/dovecot/conf.d/
Code:
namespace inbox {
prefix = INBOX.
separator = .
inbox = yes
type = private
list = yes
subscriptions = yes

mailbox Trash {
auto = subscribe
special_use = \Trash
}
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}

mailbox Spam {
auto = subscribe
special_use = \Junk
}
}

After this I check Roundcube config in /var/www/html/roundcube/config/config.inc.php and copy it to /usr/local/directadmin/custombuild/custom/roundcube/config.inc.php. Code from last lines:
Code:
// skin name: folder from skins/
$config['skin'] = 'larry';
$config['junk_mbox'] = 'INBOX.spam';
$config['default_folders'] = array('INBOX', 'Drafts', 'Sent', 'INBOX.spam', 'Trash');
$config['smtp_helo_host'] = '***'; (my hostname machine)
$config['smtp_auth_type'] = 'LOGIN';
$config['create_default_folders'] = true;
$config['protect_default_folders'] = true;
$config['login_autocomplete'] = 2;
$config['quota_zero_as_unlimited'] = true;
$config['enable_spellcheck'] = false;
$config['email_dns_check'] = true;
$config['mime_types'] = '/var/www/html/roundcube/config/mime.types';

After this I do
./build dovecot_conf
service dovecot restart
service directadmin stop and start
also reboot machine and I try create new mailbox but this mailbox doesn't have IMAP folders.

Thanks for any help.
 
Hello,

Do the folders create after you connect in RoundCube or mail program with your new account credentials?
 
What Alex means is that after you create the account you must login in the roundcube to creating folder automatically, did you do this ?
 
What Alex means is that after you create the account you must login in the roundcube to creating folder automatically, did you do this ?

Okay, now I log to Roundcube and I see created folders on new accounts. But mailbox use default Roundcube or mail client software folders. How to define in Roundcube first and Rainloop or globally Dovecot to use IMAP folders?

Thanks.
 
I could not get this to work either. Maybe I will ask a different way.

So without intervention on the stock system dovecot creates IMAP folders based on some default naming scheme and way.

Like below

INBOX
INBOX.spam
Sent
Drafts
Junk
Trash

I don't want that

I want every mail client to get and use the same structure of folders.

Inbox
Sent
Drafts
Junk
Trash
Archive
Templates
 
OK I think I sorted it... Sort of

It's a feature and 90-special-folders.conf for me at least.

First adding anything to doesn't do anything I see.
Code:
/usr/local/directadmin/custombuild/configure/dovecot/conf.d/

I even added. Nothing
Code:
/usr/local/directadmin/custombuild/custom/dovecot/conf.d/90-special-folders.conf

Then I found https://help.directadmin.com/item.php?id=2088
Which stated to add the /etc/dovecot/conf.d/force_ssl.conf
Which got me thinking in the correct direction.

So what in general I wanted was:

NOT this

INBOX
INBOX.spam < mostly not this
Sent
Drafts
Junk
Trash

I want every mail client to get and use the same structure of folders.

Inbox
Sent
Drafts
Junk
Trash
Archive

Well its a hidden feature. I took hours to hunt it down (since the directadmin.conf is not centrally documented)

It's here https://www.directadmin.com/features.php?id=1679

MAKE SURE YOU HAVE A BACKUP. Before trying this.


new directadmin.conf option, internal default to:
spam_inbox_prefix=1


if you set it to 0, all areas in DA will use "Junk" instead of INBOX.spam for paths. < Here it is I want "Junk" . eureka I found it!!


Once you set in directadmin.conf

spam_inbox_prefix=0


Code:
cd /usr/local/directadmin
systemctl restart directadmin 
cd custombuild
./build update
./build set webapps_inbox_prefix no
./build roundcube
cd ..
# This will rebuild all of your CURRENT EMAIL FOLDERS...  YOU BACKED UP CORRECT????  
echo "action=convert&value=imap_inbox_prefix" >> data/task.queue; ./dataskq d2000
echo "action=rewrite&value=filter" >> data/task.queue; ./dataskq d2000

Now you will have Junk created instead of INBOX.Spam. (Note: Junk is RFC compliant https://tools.ietf.org/html/rfc6154)

Then you have to go to

Code:
cd /etc/dovecot/conf.d

add
90-special-folders.conf

with (this worked for me)

Code:
namespace inbox {
  type = private
  separator = .
  subscriptions = yes
  inbox = yes
}
namespace inbox {
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
   auto = subscribe
   special_use = \Junk
 }
 mailbox Archive {
   auto = subscribe
   special_use = \Archive
 }
 mailbox Trash {
   auto = subscribe
   special_use = \Trash
 }
 mailbox Sent {
   auto = subscribe
   special_use = \Sent
 }
}

You can confirm it took by doing

Code:
cd /usr/local/directadmin/custombuild 
./build dovecot_conf
dovecot -n

Then copy /var/www/html/roundcube/config/config.inc.php to /usr/local/directadmin/custombuild/custom/roundcube/config.inc.php

find the entries below and set as such:

Code:
$config['drafts_mbox'] = 'Drafts';
$config['junk_mbox'] = 'Junk';
$config['sent_mbox'] = 'Sent';
$config['trash_mbox'] = 'Trash';
$config['default_folders'] = array('INBOX', 'Drafts', 'Archive', 'Sent', 'Junk', 'Trash');
$config['create_default_folders'] = true;
$config['protect_default_folders'] = true;

then

Code:
cd /usr/local/directadmin/custombuild
./build roundcube
./build dovecot_conf

Now go test with an account. make sure you login.

 
Last edited:
OK I think I sorted it... Sort of

It's a feature and 90-special-folders.conf for me at least.

First adding anything to doesn't do anything I see.
Code:
/usr/local/directadmin/custombuild/configure/dovecot/conf.d/

I even added. Nothing
Code:
/usr/local/directadmin/custombuild/custom/dovecot/conf.d/90-special-folders.conf

Then I found https://help.directadmin.com/item.php?id=2088
Which stated to add the /etc/dovecot/conf.d/force_ssl.conf
Which got me thinking in the correct direction.

So what in general I wanted was:

NOT this

INBOX
INBOX.spam < mostly not this
Sent
Drafts
Junk
Trash

I want every mail client to get and use the same structure of folders.

Inbox
Sent
Drafts
Junk
Trash
Archive

Well its a hidden feature. I took hours to hunt it down (since the directadmin.conf is not centrally documented)

It's here https://www.directadmin.com/features.php?id=1679

MAKE SURE YOU HAVE A BACKUP. Before trying this.


new directadmin.conf option, internal default to:
spam_inbox_prefix=1


if you set it to 0, all areas in DA will use "Junk" instead of INBOX.spam for paths. < Here it is I want "Junk" . eureka I found it!!


Once you set in directadmin.conf

spam_inbox_prefix=0


Code:
cd /usr/local/directadmin
systemctl restart directadmin 
cd custombuild
./build update
./build set webapps_inbox_prefix no
./build roundcube
cd ..
# This will rebuild all of your CURRENT EMAIL FOLDERS...  YOU BACKED UP CORRECT????  
echo "action=convert&value=imap_inbox_prefix" >> data/task.queue; ./dataskq d2000
echo "action=rewrite&value=filter" >> data/task.queue; ./dataskq d2000

Now you will have Junk created instead of INBOX.Spam. (Note: Junk is RFC compliant https://tools.ietf.org/html/rfc6154)

Then you have to go to

Code:
cd /etc/dovecot/conf.d

add
90-special-folders.conf

with (this worked for me)

Code:
namespace inbox {
  type = private
  separator = .
  subscriptions = yes
  inbox = yes
}
namespace inbox {
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
   auto = subscribe
   special_use = \Junk
 }
 mailbox Archive {
   auto = subscribe
   special_use = \Archive
 }
 mailbox Trash {
   auto = subscribe
   special_use = \Trash
 }
 mailbox Sent {
   auto = subscribe
   special_use = \Sent
 }
}

You can confirm it took by doing

Code:
cd /usr/local/directadmin/custombuild 
./build dovecot_conf
dovecot -n

Then copy /var/www/html/roundcube/config/config.inc.php to /usr/local/directadmin/custombuild/custom/roundcube/config.inc.php

find the entries below and set as such:

Code:
$config['drafts_mbox'] = 'Drafts';
$config['junk_mbox'] = 'Junk';
$config['sent_mbox'] = 'Sent';
$config['trash_mbox'] = 'Trash';
$config['default_folders'] = array('INBOX', 'Drafts', 'Archive', 'Sent', 'Junk', 'Trash');
$config['create_default_folders'] = true;
$config['protect_default_folders'] = true;

then

Code:
cd /usr/local/directadmin/custombuild
./build roundcube
./build dovecot_conf

Now go test with an account. make sure you login.


Great, thanks. This is work's good, but I have one question because after first configuration on new created mailbox, I have additional folders like: Trash,Drafts, Sent and this is not working, and I wan't to delete it because your configuration work, and all inbox with mails are synchro.
 
Back
Top