go to bug id or search bugs for
Almost no imap call should use the msg_no.
This is way to risky on a really fast running imap server.
imap_delete ( resource $imap_stream , int $msg_number [, int $options = 0 ] )
are taking a terrible chance the mailbox order hasn't changed from deletes, writes, new mail, etc. on the imap server. the imap msg_uid is a much safer course to get the correct msg to delete or modify.
Adding a return field msg_uid to imap_append is needed to correct this problem.
The following article at stackoverflow illustrates this problem:
You can read it here:
PHP IMAP get uid after using imap append to add sent mail to imap mailbox
Id like to get the message uid for the message i appended. Here is the code, which is untested and am sure is wrong:
$imapStream = imap_open($imapPath,$imapUser,$imapPass);
$check = imap_check($imapStream);
Basically, what I do after the imap_append call is run an imap_check to get the message count, then i pass the message count into the imap_uid to get the message uid. This can't possibly be right, but this is the first time I've worked with imap and Im just trying to figure this out.
Any help would be greatly appreciated.
asked May 30 at 2:32
Nope, this is wrong -- you have a race condition in there which you will hit if another message arrives between the time you've APPENDed the message and the time you consult the number of messages.
You might want to use the UIDPLUS IMAP extension, if available, and consult the APPENDUID response code. If this is not available for some reason, your most reliable bet is sending a UID SEARCH command with one condition, a HEADER match for the Message-Id header of the message you've just appended. If you get none or more than one UIDs back, then you're screwed.
Add a Patch
Add a Pull Request
Related To: Bug #73979