I've been working with IMAP and created a folder using (imap_createmailbox) inside my mailbox. So far so good. The problem is that I've been trying to move some emails (using imap_mail_move function) into this folder created by myself, but I haven't had luck with it and no email is moved at all.
Here is what I've been doing:
$mail_box = 'my imap server address without INBOX after "}"';
$mail_user = "my email";
$mail_pass = "my pass";
$conn = imap_open ($mail_box."INBOX", $mail_user, $mail_pass) or die (imap_last_error ());
$num_msgs = imap_num_msg($conn);
For ($n=1;$n<=$num_msgs;$n++) {
$id = imap_uid($conn, $n);
If (imap_createmailbox ($conn, $mail_box."INBOX.". MyNewfolder))
{
imap_mail_move($conn, $id, "INBOX/".MyNewFolder, CP_UID);
}
}
Does anyone has any idea why haven't I been able to move these emails into the new Folder.
PS: If I create a folder out of email INBOX, then the emails get moved as expected, except when this folder is inside INBOX.
I'm leaving my thanks here in advance.
Best regards,
M.J.