MimeMessageDispose Method

Releases all resources used by the MimeMessage object.

Definition

Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public void Dispose()

Implements

IDisposableDispose

Remarks

Call Dispose when you are finished using the MimeMessage. The Dispose method leaves the MimeMessage in an unusable state. After calling Dispose, you must release all references to the MimeMessage so the garbage collector can reclaim the memory that the MimeMessage was occupying.

The Body and its structural descendants are disposed iteratively, in child-before-parent order, before this message's Dispose(Boolean) method is called. If cleanup fails, all remaining cleanup hooks are still attempted, then the exception is rethrown (or multiple exceptions are reported in an AggregateException). Calling Dispose again retries incomplete cleanup without repeating successful cleanup hooks. The tree must not be modified or disposed concurrently during disposal.

See Also