[imp] auto create folder
Michael M Slusarz
slusarz at horde.org
Fri May 13 03:50:32 UTC 2011
Quoting Laurent Foucher <laurent.foucher at iut-tlse3.fr>:
> Hi,
>
> Based on the script found on the wiki, default folders are created
> if not exists with imp4. Here the script i use :
>
> if (!function_exists('_imp_hook_postlogin')) {
> function _imp_hook_postlogin($actionID, $isLogin)
> {
> global $prefs;
> require_once '/usr/share/horde3/imp/lib/Folder.php';
>
> $imp_folder = &IMP_Folder::singleton();
> $folder_options = array(
> 'sent_mail_folder', 'drafts_folder', 'trash_folder',
> 'spam_folder'
> );
> foreach ($folder_options as $this_folder) {
> $folder = $prefs->getValue($this_folder, true);
> if ($folder) {
> $folder = IMP::folderPref($folder, true);
> if (!$imp_folder->exists($folder)) {
> $imp_folder->create($folder, true);
> }
> }
> }
> }
> }
These folders will all be auto-created the first time they are needed.
If you want to auto-create on first login so that the user actually
sees the mailbox in folder lists, you should use the authinitialized
hook.
michael
___________________________________
Michael Slusarz [slusarz at horde.org]
More information about the imp
mailing list