Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow adding attachment to AttachmentCollection as asynchronous operation #670

Closed
ultimaweapon opened this issue Apr 27, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@ultimaweapon
Copy link

Is your feature request related to a problem? Please describe.
I want to add attachments to AttachmentCollection from Stream in a non-blocking fashion.

Describe the solution you'd like
Add two methods with the following signature:

Task<MimeEntity> AddAsync(string fileName, Stream stream, ContentType contentType, CancellationToken cancellationToken = default)
Task<MimeEntity> AddAsync(string fileName, Stream stream, CancellationToken cancellationToken = default)

Describe alternatives you've considered
Create a MemoryStream and copy the content of attachment to it with Stream.CopyToAsync then pass it to AttachmentCollection.Add.

Additional context
My application need to read attachments from a network socket. If I pass Stream directly to AttachmentCollection.Add it will cause thread blocking too long due to latency of the network socket; thus degrade the performance significantly.

@jstedfast jstedfast added the enhancement New feature or request label Apr 27, 2021
jstedfast added a commit that referenced this issue Apr 27, 2021
@jstedfast
Copy link
Owner

Good suggestion. Thanks!

This will be included in the next release. In the meantime, you can use the nightly builds from https://www.myget.org/feed/mimekit/package/nuget/MimeKit

It should have a build version >= 2.11.0.26 once it finishes building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants