views:

42

answers:

0

Hi guys I'm building a simple mail interface for my application but I've noticed that its really slow especially when the user has to list out a number of emails. I've traced the time taken for code to execute and found that just the $mail->getMessage function takes around 0.6 seconds to execute.

My code is as below:

$mail = new Zend_Mail_Storage_Imap(array(   'host' => $current_dept->incoming_server,
                                                                        'ssl' =>($current_dept->imap_ssl == 'Y' ? true : false), // $current_dept('imap_ssl'),
                                                                        'port'=>$current_dept->incoming_port,
                                                                        'folder'=>$options->box,
                                                                        'user' =>$current_dept->email,
                                                                            'password' =>$current_dept->email_psd));
.....
$one_message = $mail->getMessage($i); //<-- this takes forever about 0.5 seconds

COnsider that this code is running in a loop i.e the fetch message part and for each message an overhead time of 0.5 seconds is too much. Is there another way to do this?