Mime EntityWrite To Async(String, Cancellation Token) Method
Asynchronously write the MimeEntity to the specified file.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
An awaitable task.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public Task WriteToAsync(
string fileName,
CancellationToken cancellationToken = default
)Parameters
- fileName String
- The file.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
TaskAn awaitable task.
Implements
IMimeEntityWriteToAsync(String, CancellationToken)Remarks
Asynchronously writes the entity to the specified file using the default formatting options.
Exceptions
| ArgumentNullException | fileName is . |
| ArgumentException | fileName is a zero-length string, contains only white space, or contains one or more invalid characters. |
| ObjectDisposedException | The MimeEntity has been disposed. |
| OperationCanceledException | The operation was canceled via the cancellation token. |
| DirectoryNotFoundException | fileName is an invalid file path. |
| FileNotFoundException | The specified file path could not be found. |
| UnauthorizedAccessException | The user does not have access to write to the specified file. |
| IOException | An I/O error occurred. |