MailServiceDisposeAsync Method

Asynchronously releases all resources used by the MailService object.

Definition

Namespace: MailKit
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
public ValueTask DisposeAsync()

Return Value

ValueTask
A task that represents the asynchronous dispose operation.

Implements

IAsyncDisposableDisposeAsync

Remarks

Asynchronously releases all resources used by the MailService object, allowing the service to be used with await using.

Like Dispose, this method does not send any commands to the server (such as LOGOUT or QUIT). To disconnect cleanly, call DisconnectAsync(Boolean, CancellationToken) with a value of before disposing the service.

After calling DisposeAsync, you must release all references to the MailService so the garbage collector can reclaim the memory that the MailService was occupying.

See Also