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":
<?php
$mbox = imap_open('{imap.example.com}INBOX', 'username', 'password');
imap_renamemailbox($mbox, '{imap.example.com}INBOX.Foo', '{imap.example.com}INBOX.Bar');
imap_close($mbox);
?>
imap_renamemailbox
(PHP 4, PHP 5)
imap_renamemailbox — Posta kutusunun ismini değiştirir
Açıklama
bool imap_renamemailbox
( resource
$imap_akımı
, string $eskisi
, string $yenisi
)Posta kutusunun ismini değiştirir. Posta kutusu isimlerinin biçemi için imap_open() işlevine bakın.
Değiştirgeler
-
imap_akımı -
imap_open() işlevinden dönen bir IMAP akımı.
-
eskisi -
Eski posta kutusu ismi.
-
yenisi -
Yeni posta kutusu ismi.
Dönen Değerler
Başarı durumunda TRUE, başarısızlık durumunda FALSE döner.
Ayrıca Bakınız
- imap_createmailbox() - Yeni bir posta kutusu oluşturur
- imap_deletemailbox() - Bir posta kutusunu siler
Christoffer Lindahl ¶
2 years ago
josh at paducahwebpublishing dot com ¶
13 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.
