| Author |  | 
      
        | inform_sabya Newbie
 
  
  
 Joined: 20 January 2011
 Location: India
 Online Status: Offline
 Posts: 18
 | 
          My Code
           | Posted: 27 January 2011 at 4:06am | IP Logged |   |  
           | 
 |  ============================================================ ====
 string webMailProPath = ConfigurationManager.AppSettings["WebMailProPath"];
 string webMailProURL = ConfigurationManager.AppSettings["WebMailProURL"];
 Integration integration = new Integration(webMailProPath, webMailProURL);
 
 //Getting web mail password from DB
 ISM.DRM.Common.User _theUser = new ISM.DRM.Common.User();
 string webMailPassword =
 Convert.ToString(_theUser.GetWebMailPassword(DRMSession.User .UserID));
 
 WebmailSettings settings = (new
 WebMailSettingsCreator()).CreateWebMailSettings();
 MailBee.ImapMail.Imap.LicenseKey  = (settings.LicenseKey.Length >=
 39) ? settings.LicenseKey.Substring(0, 39) : settings.LicenseKey;
 
 if
 (integration.UserExists(Convert.ToString(DRMSession.User.Int ernalEmail),
 Convert.ToString(DRMSession.User.InternalEmail), webMailPassword))
 {
 // Check webmail password is active or not
 if (!String.IsNullOrEmpty(webMailPassword))
 {
 Imap mailer = new Imap();
 //Connect to the server, login and select inbox.
 
 mailer.Connect(Convert.ToString(ConfigurationManager.AppSett ings["IncomingIMAP"]
 ));
 
 mailer.Login(Convert.ToString(DRMSession.User.InternalEmail) , webMailPassword,
 AuthenticationMethods.Regular);
 mailer.SelectFolder("INBOX");
 //Download the latest messages.
 if (mailer.MessageCount > 0)
 {
 
 mailer.DownloadEntireMessages(mailer.MessageCount.ToString() + ":*", false);
 }
 //Disconnect from the server.
 mailer.Disconnect();
 }
 }
 ============================================================ ====
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6167
 | 
          Thanks for sharing! It might become a useful start for someone doing the similar
           | Posted: 27 January 2011 at 4:46am | IP Logged |   |  
           | 
 |  thing. I don't see what kind of problems you're having with this though.
 
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  |