Couple of IMAP questions

This is a discussion on Couple of IMAP questions within the PHP General forums, part of the PHP Programming Forums category; I writing a script to fetch bounced emails from a dedicated mailbox. $mbox = imap_open($addr, $user, $pw); I've got ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-27-2007
Al
 
Posts: n/a
Default Couple of IMAP questions

I writing a script to fetch bounced emails from a dedicated mailbox.

$mbox = imap_open($addr, $user, $pw);

I've got a simple foreach(){
> $bodyStr = imap_body($mbox, $num);
> ...
> $hdrStr = imap_fetchheader($mbox, $num);
> ....


Using 110/pop3 is incredibly slow. The php documentation implies that using the
direct IMAP connection may be faster. But, I can't get it to work with
{foo.org:143/imap} with or without the "/imap". "110/pop3" works fine.

Is IMAP really faster? If not, I'll not bother trying to get IMAP to work.

Second question: I need data from both the bounced header and the original
header, which is in the bounced body. Thus, I used imap_fetchheader() and
imap_body(). Obviously this requires two fetches.

Is there a way to fetch the whole message with one fetch? I can't find a
function to do it.


Thanks....
Reply With Quote
  #2 (permalink)  
Old 11-27-2007
Chris
 
Posts: n/a
Default Re: [PHP] Couple of IMAP questions

Al wrote:
> I writing a script to fetch bounced emails from a dedicated mailbox.
>
> $mbox = imap_open($addr, $user, $pw);
>
> I've got a simple foreach(){
>> $bodyStr = imap_body($mbox, $num);
>> ... $hdrStr = imap_fetchheader($mbox, $num);
> > ....

>
> Using 110/pop3 is incredibly slow.


Is it slow if you manually telnet in to the port?

telnet domain.com 110

then enter
user username
pass password

and see how long that takes to come up.

Some pop3 servers are slower than others because of they way they handle
things. Some use mbox files which contain all emails in one huge file
and then when you log in, they copy it to a temp file, so if you're
checking an account with a lot of email, this is going to take a while.
Some lock the account so nobody else can log in (and don't do the
copying around). Some use maildir structures where each file on the
server is a separate email the account has received, and they don't copy
the file(s) around when you log in.

So it really depends on the mail server setup.

> The php documentation implies that
> using the direct IMAP connection may be faster. But, I can't get it to
> work with
> {foo.org:143/imap} with or without the "/imap". "110/pop3" works fine.


Probably because you're not running an imap email server. They are two
different types of servers and are usually set up separately.

> Is IMAP really faster? If not, I'll not bother trying to get IMAP to work.


No idea about that one.

> Second question: I need data from both the bounced header and the
> original header, which is in the bounced body. Thus, I used
> imap_fetchheader() and imap_body(). Obviously this requires two fetches.
>
> Is there a way to fetch the whole message with one fetch? I can't find a
> function to do it.


I don't think so. I wrote some similar code a few months ago and had to
do it in 2 goes as well.

--
Postgresql & php tutorials
http://www.designmagick.com/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:06 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0