Jump to content


Photo

imap extension, pop3 and UIDL, is it possible?


  • Please log in to reply
8 replies to this topic

#1 Jak

Jak
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 05 October 2006 - 10:19 PM

Hey,
Quick question, is there any way, at all, to get the UIDL data from a pop3 server using just the php imap extension functions?

I’m currently using PEAR's Net_POP3 package to get the e-mails, and this returns the UIDL successfully. However that package isn’t as feature rich as the imap extension, so I’m still having to use other packages and functions to perform additional tasks (such as Mail_mime).

If I can use the imap extension I would like to, but I don’t want to do it unless I can do the whole job with it. I don’t want to write my own function or use another class to get the UIDL data, as that requires making two connections to the mail server, and is generally pretty sloppy.

Thanks in advance,
Jack
Jack

#2 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 05 October 2006 - 10:33 PM

No IMAP, PHP does not support direct access to the UIDL for POP3, but you can get it with...

$obj_header = imap_headerinfo ( $box, $number );

$uidl = $obj_header->message_id;

Please understand PHP gives you core functions, but that does not mean you can not do the some thing some other way that the core doesn't support, sometimes your made up way will even be 5X to 10X faster than the core way! In this case it shouldn't case a problem, because I would think you still need the header info, so it wouldn't be a extra function call!

me!





#3 Jak

Jak
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 05 October 2006 - 10:38 PM

Cheers for your reply, but the value of message_id is not the same as the UIDL. I have got a system that works perfectly well using the pear packages, but i just assumed that using those classes would be slower than the all-in-one imap extension. Its a shame that the extension dosent support it, as it seems to be the only thing missing (from my point of view).

I read somewhere that the author said it simply cannot be done, but i know thats wrong seeing as the PEAR packages can do it, and you can very easily get the UIDLs using telnet or something.
Jack

#4 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 05 October 2006 - 10:59 PM

I tried it with what I told you, it worked on Merak Windows, but not Merak Linux, Postfix or Courier. But it does work on all of them if I use fsockopen() or the PHP POP3 extension, I wonder what the PHP IMAP extension does different than using a socket or the POP3 extension. I will have to look at the source and see. Have tried the PHP POP3 extension, I justed it and it seem to work.

me!

#5 Jak

Jak
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 05 October 2006 - 11:05 PM

I dont know about the POP3 extension, my hosts dont have it installed so i cant use it :( . If you find anything out that would be great, cheers.
Jack

#6 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 05 October 2006 - 11:15 PM

I will post something when I look at it later, are you running PHP 4 or 5? Do you want the fsockopen() function to get the uidl?

me!

#7 Jak

Jak
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 05 October 2006 - 11:21 PM

Im running 5, ive written a function that uses fsocketopen already, but dont want to use it as you end up with two connections to the server, which (although unlikley) could be out of sync if the messages changed during connecting to the two?
Jack

#8 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 05 October 2006 - 11:40 PM

got ya, I will look at the CVS source tree for version 5, and see if I can find another way to get the UIDL for you.

me!

#9 Jak

Jak
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 06 October 2006 - 06:53 AM

Thanks, that would be incredibly useful, cheers for all your help.
Jack




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users