SmtpRaiseEventsViaMessageLoop Property
Gets or sets whether the events will be raised on the message loop of the application or not.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public bool RaiseEventsViaMessageLoop { get; set; }

Property Value

Type: Boolean
A bool value indicating whether the events will be raised on the message loop of the application or not. The default value is true.
This property is only meaningful in WinForms applications where events and asynchronous methods are used, and the developer needs to block the message loop for some reason (usually, to wait for completion of an asynchronous method). In this case, you should set this property to false and use Wait method to wait until asynchronous MailBee method is finished. See Wait method for more information.

The above also applies to synchronous methods if they are called on worker (non-UI) threads. If, however, the application does not use asynchronous methods of MailBee (and never calls its synchronous methods on non-UI threads), it should NOT attempt to set RaiseEventsViaMessageLoop to false or use Wait method.

Note Note
If you develop non-WinForms application (such as web or console application), you do not need to set this property or use Wait method regardless if the application uses worker threads or not.
Another alternative (in WinForms application) to using Wait method is to never block the application message loop and use callback functions instead of waiting for asynchronous method completion.
Note Note
In many cases, it's easier not to use events at all but derive a new class from Smtp class and override corresponding OnEventName method in order to get the developer-supplied code executed. See OnConnected(ConnectedEventArgs) method documentation for more information.
See Also