imap_createmailbox Create a new mailbox &reftitle.description; boolimap_createmailbox resourceimap_stream stringmailbox Creates a new mailbox specified by mailbox. &reftitle.parameters; &imap.imap-stream.description; mailbox The mailbox name, see imap_open for more information. Names containing international characters should be encoded by imap_utf7_encode &reftitle.returnvalues; &return.success; &reftitle.examples; <function>imap_createmailbox</function> example \n"; // we will now create a new mailbox "phptestbox" in your inbox folder, // check its status after creation and finally remove it to restore // your inbox to its initial state if (@imap_createmailbox($mbox, imap_utf7_encode("{imap.example.org}INBOX.$newname"))) { $status = @imap_status($mbox, "{imap.example.org}INBOX.$newname", SA_ALL); if ($status) { echo "your new mailbox '$name1' has the following status:
\n"; echo "Messages: " . $status->messages . "
\n"; echo "Recent: " . $status->recent . "
\n"; echo "Unseen: " . $status->unseen . "
\n"; echo "UIDnext: " . $status->uidnext . "
\n"; echo "UIDvalidity:" . $status->uidvalidity . "
\n"; if (imap_renamemailbox($mbox, "{imap.example.org}INBOX.$newname", "{imap.example.org}INBOX.$name2")) { echo "renamed new mailbox from '$name1' to '$name2'
\n"; $newname = $name2; } else { echo "imap_renamemailbox on new mailbox failed: " . imap_last_error() . "
\n"; } } else { echo "imap_status on new mailbox failed: " . imap_last_error() . "
\n"; } if (@imap_deletemailbox($mbox, "{imap.example.org}INBOX.$newname")) { echo "new mailbox removed to restore initial state
\n"; } else { echo "imap_deletemailbox on new mailbox failed: " . implode("
\n", imap_errors()) . "
\n"; } } else { echo "could not create new mailbox: " . implode("
\n", imap_errors()) . "
\n"; } imap_close($mbox); ?> ]]>
&reftitle.seealso; imap_renamemailbox imap_deletemailbox