Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: How to avoid redundant connec and login Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
hamipers
Newbie
Newbie


Joined: 06 March 2008
Location: United States
Online Status: Offline
Posts: 11
Posted: 14 April 2008 at 9:18am | IP Logged Quote hamipers

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 View hamipers's Profile Search for other posts by hamipers
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 15 April 2008 at 5:22am | IP Logged Quote Andrew

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 View Andrew's Profile Search for other posts by Andrew
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide