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


Groups > comp.lang.php > #14426 > unrolled thread

mail attachment - UID on pop/imap is different

Started byJan Novak <repcom@gmail.com>
First post2014-10-29 09:44 +0100
Last post2014-10-30 12:42 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.lang.php


Contents

  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

#14426 — mail attachment - UID on pop/imap is different

FromJan Novak <repcom@gmail.com>
Date2014-10-29 09:44 +0100
Subjectmail attachment - UID on pop/imap is different
Message-ID<m2q9fm$54r$1@news.albasani.net>
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

[toc] | [next] | [standalone]


#14427

FromJerry Stuckle <jstucklex@attglobal.net>
Date2014-10-29 14:33 -0400
Message-ID<m2rbub$kf6$1@dont-email.me>
In reply to#14426
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
==================

[toc] | [prev] | [next] | [standalone]


#14430 — SOLVED: mail attachment - UID on pop/imap is different

FromJan Novak <repcom@gmail.com>
Date2014-10-30 08:39 +0100
SubjectSOLVED: mail attachment - UID on pop/imap is different
Message-ID<m2sq32$u5o$1@news.albasani.net>
In reply to#14427
Am 29.10.2014 um 19:33 schrieb Jerry Stuckle:

>
> 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.
>

Because on my code i do not ger the attachment with imap uid.
But with pop uid. And the pop uid works also with impa protocol.
BUT ... it was an mistake from me - i had in code not the right 
variable. so now its working (after i send the mail i have found the bug).

Jan

[toc] | [prev] | [next] | [standalone]


#14431 — Re: SOLVED: mail attachment - UID on pop/imap is different

FromAllodoxaphobia <knock_yourself_out@example.net>
Date2014-10-30 12:42 +0000
SubjectRe: SOLVED: mail attachment - UID on pop/imap is different
Message-ID<slrnm54cik.49h.knock_yourself_out@vps.jonz.net>
In reply to#14430
On Thu, 30 Oct 2014 08:39:59 +0100, Jan Novak wrote:

> ... . so now its working (after i send the mail i have found the bug).

That happens to ALL of us.
It seems to be _my_ most popular debugging technique.  :-)

Jonesy
-- 
  Marvin L Jones    | Marvin      | W3DHJ  | linux
   38.238N 104.547W |  @ jonz.net | Jonesy |  FreeBSD
    * Killfiling google & XXXXbanter.com: jonz.net/ng.htm

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web