6.0.0-beta13
4/14/26

After scouring Google for several days looking for a solution to this common question, and after subtle prodding on the Imp mailing list, I decided to roll my own method of making IMP create the default sent, trash, drafts, and spam folders as defined in "horde/imp/config/prefs.php" the first time a user logs in. This code was written for IMP 4.1.x.

What we need to do is create a Maintenance Task in the IMP The first thing we need to do is create a maintenance task. This is done by creating a PHP script called "horde/imp/lib/Maintenance/Tasks/create_default_folders.php" which contains the following class:

getValue($this_folder, true), true); if ($folder) { $imp_folder = &IMP_Folder::singleton(); if (!$imp_folder->exists($folder)) { $imp_folder->create($folder, true); } } } return true; } function describeMaintenance() { return _("This process makes sure the default folders are created on your account."); } } ?>

Now you'll need to edit "horde/imp/lib/Maintenance/imp.php" to reflect this change:

 var $maint_tasks = array(

    'tos_agreement'              => MAINTENANCE_FIRST_LOGIN,

    'create_default_folders'     => MAINTENANCE_FIRST_LOGIN,

// If you have users who often "accidently" delete their folders, you can do this instead:

// 'create_default_folders' => MAINTENANCE_EVERY,

    'fetchmail_login'            => MAINTENANCE_EVERY,

    'rename_sentmail_monthly'    => MAINTENANCE_MONTHLY,

    'delete_sentmail_monthly'    => MAINTENANCE_MONTHLY,

    'delete_attachments_monthly' => MAINTENANCE_MONTHLY,

    'purge_trash'                => MAINTENANCE_MONTHLY

);

Finally, add a preference in "horde/imp/config/prefs.php" like this:

$_prefs['create_default_folders'] = array(

    'value' => 1,

    'locked' => false,

    'shared' => false,

    'type' => 'implicit');