PHP: Hypertext Preprocessor (original) (raw)

imap_renamemailbox

(PHP 4, PHP 5, PHP 7, PHP 8)

imap_renamemailbox — Rename an old mailbox to new mailbox

Description

This function renames on old mailbox to new mailbox (seeimap_open() for the format ofmbox names).

Return Values

Returns [true](reserved.constants.php#constant.true) on success or [false](reserved.constants.php#constant.false) on failure.

Changelog

Version Description
8.1.0 The imap parameter expects an IMAP\Connection instance now; previously, a valid imap resource was expected.

See Also

Found A Problem?

josh at paducahwebpublishing dot com

25 years ago

`Don't let "...string old_mbox, string new_mbox);" fool you. You have to add the server and port to the mailbox name also. So it would be something like:

imap_renamemailbox($mailbox, "{localhost:143}$oldfolder", "{localhost:143}$newfolder")

Just thought I would point it out, it took me a while to figure it out.

`

Christoffer Lindahl

14 years ago

`Don't forget that you can't be connected to the mailbox that you are going to rename (or delete).

If you have the following mailboxes:
INBOX
INBOX.Foo

...and want to rename "INBOX.Foo" to "INBOX.Bar" you have to be connected to "INBOX":

`