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

Feature Request - Serialising MimeEntity without headers #207

Closed
polterguy opened this issue Dec 12, 2015 · 4 comments
Closed

Feature Request - Serialising MimeEntity without headers #207

polterguy opened this issue Dec 12, 2015 · 4 comments
Labels
enhancement New feature or request

Comments

@polterguy
Copy link

Howdy Jeff,

I've been fiddling with your library pretty much lately, as you probably know. I still haven't figured out how to serialise a MimeEntity without its headers though. There's the "WriteTo" method, which dumps the entire entity to whatever stream I supply. But I'd love to be able to serialise an entity without its headers.

The reason why I am asking, is because I have this logic where I send a MimeEntity over en HTTP WebResponse, as the result of a WebService, where I'd normally want to put the headers for the root entity inside of the response HTTP headers, and not have them being part of content sent. I could use "WriteTo" and serialise also the headers, but I am pretty certain that I'd be breaking several known internet standards if I do.

So basically, I'd like to pass the headers of the root entity over on the HTTP response header collection, and then only serialise the "content" of the root entity.

Now there are several other use-cases for the same feature, such as having an HTML form object with enctype of "multipart/form-data", where the headers of the root multipart would be sent in the request header collection, and not being part of actual content passed. So I am pretty certain I am not (completely) alone in wanting this feature.

What I'd imagine, is that this could probably be quite easy with another enum value for the "FormatOptions" enum. Alternatively an overload of WriteTo or an additional method that only sends the MimeEntity's content.

The only viable route today, without adding features in MimeKit, seems to be traversing the entity myself, using the "ContentObject", which would create literally hundreds of lines of code for me, and others in the same position. While I am imagining it's a "one liner" inside of MimeEntity's WriteTo method ...?

Notice, I don't know which type my MimeEntity is, it can be Multipart, MimePart, MultipartSigned, etc, etc, etc ...

I simply want an overload (or tips as to how to solve it myself) for serialising the entity without its headers ...

Thx,

.t

@polterguy polterguy changed the title Serialising MimeEntity without headers Feature Request - Serialising MimeEntity without headers Dec 12, 2015
@polterguy
Copy link
Author

BTW, sinde there is already an overload of "MimeEntity.Load" taking ContentType parameter, for the other side of the equation, it seems as if it's "almost there". Only missing that tiny little detail from above ... ;)

@jstedfast jstedfast added the enhancement New feature or request label Dec 13, 2015
@jstedfast
Copy link
Owner

I've implemented a WriteTo() method that takes a bool contentOnly flag.

@polterguy
Copy link
Author

Awesome!! 🎯 :D

@jstedfast
Copy link
Owner

MimeKit 1.2.18 just released to nuget supports this.

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