| Author |  | 
      
        | Guests Guest Group
 
  
 
 Joined: 10 November 2003
 Online Status: Online
 Posts: 262
 | 
          
           | Posted: 08 March 2005 at 7:46pm | IP Logged |   |  
           | 
 |  I get the error '[Error: Already connected]' when using this code copied from your FAQ, any suggestions ? Thanks.
 
 Dim Mailer, Msg, Msgs
 Set Mailer = CreateObject("MailBee.POP3")
 Mailer.LicenseKey = "<my key>"
 Mailer.Connect HOST, PORT, USERNAME, PASSWORD
 If Mailer.Connect Then
 Set Msgs = Mailer.RetrieveHeaders
 Response.Write Msgs.Count & " messages total in mailbox<br>"
 For Each Msg In Msgs
 Response.Write "Subject: " & Msg.Subject & "<br>"
 Next
 Mailer.Disconnect
 Else
 Response.Write Mailer.ErrDesc
 End  If         &nbs p;
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Guests Guest Group
 
  
 
 Joined: 10 November 2003
 Online Status: Online
 Posts: 262
 | 
          Also it works if I remove the IF THEN check ...
           | Posted: 08 March 2005 at 7:53pm | IP Logged |   |  
           | 
 |  
 
 Dim Mailer, Msg, Msgs
 Set Mailer = CreateObject("MailBee.POP3")
 Mailer.LicenseKey =  "MBC500-A4ACD4E493-E90B0116BB66090F8B4DC2360EC1027C" &n bsp;
 Mailer.Connect HOST, PORT, USERNAME,  PASSWORD        &nbs p;
 'If Mailer.Connect Then
 Set Msgs = Mailer.RetrieveHeaders
 Response.Write  "Total of " & Msgs.Count & " messages are avialable on the server.<br>"
 For Each Msg In Msgs
 Response.Write  "Subject: " & Msg.Subject & "<br>"
 Next
 Mailer.Disconnect
 'Else
 '  Response.Write Mailer.ErrDesc
 'End  If         &nbs p;
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          In your code call to Connect method is made twice - this caused an error. If you open FAQ once again, you can see the following syntax is used:
           | Posted: 09 March 2005 at 7:45am | IP Logged |   |  
           | 
 |  
 Mailer.Connect ...
 If Mailer.Connected Then
 ...
 
 Connected is a property while Connect is a method.
 
 Or, you can use one line instead of two:
 
 If Mailer.Connect(...) Then
 
 Anyway, only one call to Connect method is allowed.
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  |