Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14427

Re: mail attachment - UID on pop/imap is different

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: mail attachment - UID on pop/imap is different
Date 2014-10-29 14:33 -0400
Organization A noiseless patient Spider
Message-ID <m2rbub$kf6$1@dont-email.me> (permalink)
References <m2q9fm$54r$1@news.albasani.net>

Show all headers | View raw


On 10/29/2014 4:44 AM, Jan Novak wrote:
> Hi all,
> 
> again i have a new problem with my mail attachments.
> If i connect to the mailbox via pop, i get the right message numbers
> (uid) - with imap i get different numbers, what are not working.
> 
> The impotrtant row below is this: $uid = imap_uid($imap, $i);
> once again: same code, with pop it is ok, with imap it doesent.
> 
> What can be the problem ?
> 
> My code:
> ---------------------------------------------------------------------
> $numMessages = imap_num_msg($imap);
> if ($numMessages >0){
>     for ($i = 1; $i <= $numMessages; $i++) {
>         $header = imap_header($imap, $i);
> 
>         // var_dump($header);
>         // doesent matter pop / imap gets the same result in var_dump
>         $fromInfo = $header->from[0];
>         $replyInfo = $header->reply_to[0];
>     
>         $details = array(
>                 "fromAddr" => (isset($fromInfo->mailbox) &&
> isset($fromInfo->host))
>                 ? $fromInfo->mailbox . "@" . $fromInfo->host : "",
>                 "fromName" => (isset($fromInfo->personal))
>                 ? $fromInfo->personal : "",
>                 "replyAddr" => (isset($replyInfo->mailbox) &&
> isset($replyInfo->host))
>                 ? $replyInfo->mailbox . "@" . $replyInfo->host : "",
>                 "replyName" => (isset($replyTo->personal))
>                 ? $replyto->personal : "",
>                 "subject" => (isset($header->subject))
>                 ? $header->subject : "",
>                 "udate" => (isset($header->udate))
>                 ? $header->udate : ""
>         );
>         $uid = imap_uid($imap, $i);
>         $mailStruct = imap_fetchstructure($imap, $i);
>         $attachments = getAttachments($imap, $i, $mailStruct, "");
>         //
>         //this is not working with incorrect $uid
>         //
>         mailList($details, $attachments, $func, $folder, $uid, $imap);
>     
>     }
> }
> ---------------------------------------------------------------------
> 
> Jan

First of all, why do you think the uid on POP and IMAP servers has to be
the same?  Two different protocols do not have to have the same UID.

And why is it "wrong"?  What do you have, and what to you expect to get?

In IMAP, the uid should be constant as long as you don't close the imap
connection.  If you close and reopen it, the uid may very well change,
depending on what else has occurred in the mailbox.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

mail attachment - UID on pop/imap is different Jan Novak <repcom@gmail.com> - 2014-10-29 09:44 +0100
  Re: mail attachment - UID on pop/imap is different Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-29 14:33 -0400
    SOLVED: mail attachment - UID on pop/imap is different Jan Novak <repcom@gmail.com> - 2014-10-30 08:39 +0100
      Re: SOLVED: mail attachment - UID on pop/imap is different Allodoxaphobia <knock_yourself_out@example.net> - 2014-10-30 12:42 +0000

csiph-web