imap_renamemailbox

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

imap_renamemailboxRenombra un buzón de correo

Descripción

imap_renamemailbox(IMAP\Connection $imap, string $from, string $to): bool

imap_renamemailbox() renombra el buzón de correo from a to (ver la función imap_open() para el formato de los nombres mbox).

Parámetros

imap

An IMAP\Connection instance.

from

El antiguo nombre del buzón de correo, ver la documentación de la función imap_open() para más detalles

Advertencia

El paso de datos no confiables a este parámetro es inseguro, a menos que imap.enable_insecure_rsh esté inhabilitado.

to

El nuevo nombre del buzón de correo, ver la documentación de la función imap_open() para más detalles

Advertencia

El paso de datos no confiables a este parámetro es inseguro, a menos que imap.enable_insecure_rsh esté inhabilitado.

Valores devueltos

Devuelve true en caso de éxito o false en caso de error.

Historial de cambios

Versión Descripción
8.1.0 The imap parameter expects an IMAP\Connection instance now; previously, a valid imap recurso was expected.

Ver también

add a note

User Contributed Notes 2 notes

up
3
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.
up
1
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":

<?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);
?>
To Top