Author |
|
hamipers Newbie
Joined: 06 March 2008 Location: United States
Online Status: Offline Posts: 11
|
Posted: 14 April 2008 at 9:18am | IP Logged
|
|
|
Hello,
I have been using MailBee.NET object for sending and receiving emails in the web interface I have been writing for an email server by C#.NET 2005. There are several pages like inbox and compose pages which require the Imap or Smtp objects to be created, initialized and the methods Connect and Login need to be invoked before I take any further step in my code. But Since I use these objects frequently, for example for showing the content of the folders, showing the existing folders and ... I prefer to do the Connect and Login methods only once if possible. Because each time I do this sequence, it takes a lot of time. My users won't appreciate this delay. Anybody has any idea?
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 15 April 2008 at 5:22am | IP Logged
|
|
|
This means keeping connection with mail server alive all time your application is working. Such scenario has a problem with timeouts. If your application doesn't touch the server during some time, it'd consider your application as terminated or hang and close the connection.
In the case of a desktop application which works all the time it's opened, it may periodically ping the mail server (send noop command), so the server would know the application is still alive. But in case of a web application, this cannot be implemented because life-time of server part of the application is limited. I.e. when a user clicks something in web browser, the browser sends a request to the server which executes a script. Once the script gets completed, it returns the response to the web browser and terminates, so it'll be unable to ping the mail server until the web browser send a new request.
Moreover, to keep connection alive, you have to pass an instance of MailBee.Imap class between different pages' contexts. Of course, you may store a reference to that object in Session object, but it's not recommended to store objects or arrays in session, but only strings or numbers (small data) for performance sake.
MailBee WebMail family products (as well as other popular webmail systems) open new connections each time they become required. This is common approach for web applications due to the reasons described above.
Best regards,
Andrew
|
Back to Top |
|
|