SmtpOnConnected Method
Used by MailBee to raise Connected event.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
protected void OnConnected(
	ConnectedEventArgs args


Type: MailBeeConnectedEventArgs
The object containing event data.

When RaiseEventsViaMessageLoop is true (i.e. default value), MailBee uses this method to raise Connected event. In WinForms application, the event will be raised on the message loop thread. In other applications (such as web or console applications), threading is not a concern, and the current thread MailBee is running on will be used.

You can override this method in a derived class to force MailBee execute your own code instead of raising Connected event. This may help to avoid threading issues in WinForms applications (because events may not be raised if the message loop thread is blocked for some reason, while calling overridden methods does not depend on the message loop thread state).

Another solution of this problem is setting RaiseEventsViaMessageLoop to false and using Wait method to block the message loop thread if needed. This way, you do not need to derive any descendant class from Smtp class.

See Also