views:

16

answers:

1

I'm not sure if this is possible but here we go. I'm building an email module for my application. Basically it refers to an inbox on a mail server, it retrieves all headers of the emails and the details periodically.

The thing I've noticed is that the connection to email itself takes a while i.e 3-5 seconds of waiting time and a connection needs to be made everytime an email is to be retrieved. I was wondering if there is a way to set up a kind of permanent connection. Permanent in the sense that it can be referred to irrespective of state. Like whenever a message needs to be retrieved instead of opening a new connection - an already existing connection is used. Is such a thing possible? I'm using php here btw.

A: 

Use NOOP command periodically. You can also use the STAT command as some servers will ignore the NOOP command.

Pierre 303
Thanks but how can this be implemented using code - I would like some example code to get started.
Ali
Just send the noop or stat command. http://www.weberdev.com/get_example-4015.html
Pierre 303
I think I didn't explain exactly - is it possible to store the connection in something like a global variable or cache the connection somehow so I don't have to open up one. My application makes use of a third party library which handles whatever has been explained in the example given..
Ali