SmtpIsConnected Property
Indicates whether the component is connected to the server.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public bool IsConnected { get; }

Property Value

Type: Boolean
true if the component is connected to the server; otherwise, false.

This property only reflects the state of client side of the connection. If the server forcibly closed the connection on its side, the application won't know about this until it makes an attempt to send or receive data.

In other words, it reflects the state of the connection at the time when the last data to the moment was received.

To check if you're still connected to the server from its point of view, issue a command to the server, such as Noop. If the method throws an exception, this means the server has closed the connection. If no exception occurred, the connection is still up.

Note Note
In multi-thread mode (MaxThreadCount is NOT 1), many threads may be executed simultaneously. While the connection may be opened on one thread, it may be already closed or not yet been established on another thread. Due to this, IsConnected property is not applicable in multi-thread mode (it returns false).
See Also