Author |
|
witterholt Newbie
Joined: 04 August 2009 Location: Netherlands
Online Status: Offline Posts: 9
|
Posted: 04 August 2009 at 4:52am | IP Logged
|
|
|
Hello,
When the password does match the Login method of the Imap object succeeds and returns a True value, but when the password does not match I won't get a return value. I would expect to return False according to the documentation.
Can someone say what could be wrong?
Thanks in advance.
Greetings,
Chris.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 04 August 2009 at 5:15am | IP Logged
|
|
|
We suggest to enable IMAP logging to check what's going on. If you'd like us to help you on this, you can send us the log file for examination.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
witterholt Newbie
Joined: 04 August 2009 Location: Netherlands
Online Status: Offline Posts: 9
|
Posted: 04 August 2009 at 5:39am | IP Logged
|
|
|
I send the log. I also turned Global.SafeMode and ThrowExceptions on.
But it keeps waiting for a return value that does not come.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 04 August 2009 at 7:06am | IP Logged
|
|
|
By default, ThrowExceptions is true. So, if you set it to true, it changes nothing. You need to set it to false if you would like to have Login method return false.
Regards,
Alex
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 04 August 2009 at 7:10am | IP Logged
|
|
|
Also, make sure you're not calling another method immediately after Login. From the log, it seems something else is called after failed Login, and this may cause problems.
For instance:
bool succeeded = imp.Login(...)
imp.DownloadFolders()
if (!succeeded) { // claim error; }
If the code is something like above, the exception will be thrown by DownloadFolders methods (even if ThrowExceptions=false) because it's the programmer's error to call DownloadFolders when not connected.
Regards,
Alex
|
Back to Top |
|
|
witterholt Newbie
Joined: 04 August 2009 Location: Netherlands
Online Status: Offline Posts: 9
|
Posted: 05 August 2009 at 1:05am | IP Logged
|
|
|
I now catch the Exception and that works as expected. So if the password does not match it will generate a MailBee exception which I catch.
I would like to throw that exception to the calling assembly, but that does not seem to work.
Catch ex As MailBee.MailBeeException
oImap.ResetState()
Throw New Exception("Problem in ReadMailBox method of e-Invoice Datacollector Mail Object: ", ex)
It won't be catched by the calling assembly.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 05 August 2009 at 2:30am | IP Logged
|
|
|
Quote:
It won't be catched by the calling assembly. |
|
|
Could you please clarify this? Don't you get any exceptions at all?
We suggest to make sure that the calling assembly contains a reference to MailBee namespace and thus is aware of it.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
witterholt Newbie
Joined: 04 August 2009 Location: Netherlands
Online Status: Offline Posts: 9
|
Posted: 05 August 2009 at 5:01am | IP Logged
|
|
|
Yes.
In the calling (main) assembly I have a reference added to the MailBee.NET assembly and imported the namespace by using the "Imports MailBee".
The catch block of the called assembly looks like this:
Catch ex_mb As MailBee.MailBeeException
oImap.ResetState()
Throw New Exception("Problem in ReadMailBox method of e-Invoice Datacollector Mail Object: ", ex_mb)
Return False
Catch ex As Exception
Throw New Exception("Problem in ReadMailBox method of e-Invoice Datacollector Mail Object: ", ex)
oImap.Close()
' Disconnect and clean up
If oImap.IsConnected Then oImap.Disconnect()
Return False
End Try
The catch block of the calling assembly looks like this:
Catch Ex_Mb As MailBeeException
EventLog.WriteEntry(Me.ServiceName, "Error", EventLogEntryType.Error)
If Ex_Mb.InnerException Is Nothing Then
EventLog.WriteEntry(Me.ServiceName, "Error in CheckForMessages function." & vbCrLf & vbCrLf & _
"Error: " & Ex_Mb.Message, EventLogEntryType.Warning)
Else
EventLog.WriteEntry(Me.ServiceName, "Error in CheckForMessages function." & vbCrLf & vbCrLf & _
"Error: " & Ex_Mb.Message & _
Ex_Mb.InnerException.Message & _
Ex_Mb.InnerException.InnerException.Message & _
Ex_Mb.InnerException.InnerException.InnerException.Message, EventLogEntryType.Warning)
End If
Catch Ex As Exception
If Ex.InnerException Is Nothing Then
EventLog.WriteEntry(Me.ServiceName, "Critical error in CheckForMessages function. Service " & Me.ServiceName & " will be stopped." & vbCrLf & vbCrLf & _
"Error: " & Ex.Message, EventLogEntryType.Error)
Else
EventLog.WriteEntry(Me.ServiceName, "Critical error in CheckForMessages function. Service " & Me.ServiceName & " will be stopped." & vbCrLf & vbCrLf & _
"Error: " & Ex.Message & _
Ex.InnerException.Message & _
Ex.InnerException.InnerException.Message & _
Ex.InnerException.InnerException.InnerException.Message, EventLogEntryType.Error)
End If
' Stop the windows service
Me.Stop()
End Try
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 05 August 2009 at 7:00am | IP Logged
|
|
|
Unfortunately, we can't say why your own exceptions are not caught by your code as this is beyond the scope of MailBee. Maybe, you're using threading, and the worker thread throwing exception simply dies.
Regards,
Alex
|
Back to Top |
|
|
witterholt Newbie
Joined: 04 August 2009 Location: Netherlands
Online Status: Offline Posts: 9
|
Posted: 07 August 2009 at 8:31am | IP Logged
|
|
|
Okay, I have a workaround made so it let it rest for now.
|
Back to Top |
|
|
setven17 Newbie
Joined: 04 October 2009 Location: Philippines
Online Status: Offline Posts: 2
|
Posted: 05 October 2009 at 1:45am | IP Logged
|
|
|
at last i've come up on a solution. thank you so much. even confusion took place on me on the codes but it's okay now. thank you so much.
Company Voluntary Arrangement
|
Back to Top |
|
|