Setup IMAP folders.

factor

Verified User
Joined
Jul 22, 2017
Messages
3,769
Location
USA
All:

This was born out of these 2 posts.

https://forum.directadmin.com/showthread.php?t=54713
and
http://forum.directadmin.com/showthread.php?t=58403

Its a general How to get IMAP folders working based on the general structure of

Inbox
Sent
Drafts
Junk
Trash
Archive

Some general Notes to start.

First adding anything to these two file locations doesn't do anything I see.
Code:
/usr/local/directadmin/custombuild/configure/dovecot/conf.d/
or
Code:
/usr/local/directadmin/custombuild/custom/dovecot/conf.d/

In general with the stock install of DA you get folders like

INBOX
INBOX.spam < We don't want this
Sent
Drafts
Junk
Trash

We want every mail client to get and use the same structure of folders. We want them to auto create and auto subscribe.

Like this.

Inbox
Sent
Drafts
Junk
Trash
Archive

To do this you need a feature and 90-special-folders.conf.. 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 of all your sites and email. Before trying this.

new directadmin.conf option, internal default to:
spam_inbox_prefix=1 < this is the issue. If it's set to 1 or not in the directadmin.conf it defaults to 1 = INBOX.spam


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

Set spam_inbox_prefix=0 in directadmin.conf

Code:
/usr/local/directadmin/directadmin set spam_inbox_prefix 0
systemctl restart directadmin
cd /usr/local/directadmin/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????  Note: I didn't lose a thing.
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
nano 90-special-folders.conf

Paste below in the blank file(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

might need to create Roundcube folder.
Code:
mkdir /usr/local/directadmin/custombuild/custom/roundcube/
Code:
cp /var/www/html/roundcube/config/config.inc.php /usr/local/directadmin/custombuild/custom/roundcube/config.inc.php

find the general section with entries below and set or add to 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.

This should give you the structure noted at the beginning.

Hope this helps. Report success or issues as needed.
 
Last edited:
A bit older post, but since Junk is RFC compliant and Inbox.spam is not, maybe you can create a feature request to drop inbox.spam which is an odd name anyway?
One can customize lots of things, but as this is RFC... why not loose the odd stuff and make it decent by default?

This is already supported: https://www.directadmin.com/features.php?id=1679

Yet, I'm not sure if the internal value of new installs is 0 to be RFC compliant. If not, we should really make this move.
 
@factor

Hello dear friend please if you can take a look at my thread in detail issues. Thanks in advance!

 
@factor

Hello dear friend please if you can take a look at my thread in detail issues. Thanks in advance!

I am looking now. I will try to see if I can add anything.

So did you do all of the parts of the Guide above?

The Standard folders from above will create the very first time the user logs in.

If they have other folders in their cp backup they would be there but might not be subscribed not sure havent really had issues so not sure.
 
I am looking now. I will try to see if I can add anything.

So did you do all of the parts of the Guide above?

The Standard folders from above will create the very first time the user logs in.

If they have other folders in their cp backup they would be there but might not be subscribed not sure havent really had issues so not sure.
check my latest answer on my thread I tested 30 times today I get the results.
 
Back
Top