I'm moving emails to another inbox using code that looks a lot like this:
function move_email($stream, $uid, $destination) {
$result = imap_mail_move($stream, $uid, $destination, CP_UID);
if($result) {
imap_expunge($stream);
}
return $result;
Works great! But I'd like to be able to retrieve that particular email in the future.
My understanding is that the UID in the new box may be/will be different from the UID passed into the function. How do I retrieve the UID of the email from the mailbox specified in $destination
?
And actually, how do I fetch an email by UID at all? imap_search()
has a promising name, but it doesn't seem to be capable of returning an email by UID.