andyedinborough / aenetmail

C# POP/IMAP Mail Client
369 stars 153 forks source link

Unable to validate Login/Connection independently #56

Closed nakhli closed 12 years ago

nakhli commented 12 years ago

When a ImapClient or Pop3Client client instance is created, it connects and logs in in the constructor. There is no alternate constructor that allows only creating the instance first and then use the public methods Login and Connect later.

What is the rational behind imposing connection and login in constructor when we can switch both server and user later on?

One of the incurred issue is that the connection to server and the user login/pwd cannot be tested independently.

andyedinborough commented 12 years ago

There actually should be an empty constructor for exactly that purpose. I'm not sure how it was lost.

nakhli commented 12 years ago

It would be great if you can add it back :-)

A side note for the future: it seems that in case of error, the exceptions thrown are all of type System.Exception. If you can add specific types to help handling errors it would be great.

andyedinborough commented 12 years ago

I actually prefer to pass errors through, instead of wrapping them, to preserve the stacktrace and as much information about the error as possible.

andyedinborough commented 12 years ago

Turns out PopClient did have the empty constructor, so I'm not sure what happened with the ImapClient.

nakhli commented 12 years ago

Thank you for the quick fix.