-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
MimeMessage Load / WriteTo byte compatibility fail cases #499
Comments
…en EnsureNewLine is true Partial fix for issue #499
…ry parameter Partial fix for issue #499
Are these all representative of real-world test cases? I'm just not sure the remaining issues are worth all of the time & effort it will take to "fix" them considering they are all invalid MIME. |
Byte-for-byte compatibility with the original stream is important for us in our use cases, even when the there may be invalid MIME present. I tested for two things: byte-for-byte with the original stream with FormatOptions.EnsureNewLine = false and consistent newline addition when formatOptions.EnsureNewLine = true on headers/body. Two situations led me to look for these test cases:
This isn't a very high priority since as you said the cases are invalid MIME and would have limited impact, but they likely have "some" impact in certain cases and it'd be great if this was eventually "fixed" since it feels like MimeKit is already 98% byte-for-byte compatible and these would help get it closer to 100%. |
FWIW, MailKit's You may find that useful. I'm not sure I can ever guarantee 100% byte-for-byte compatibility in all cases when reserializing a MimeMessage. I'm just not sure it's even feasible without making I could also potentially add something that would allow you to do
You know what they say about the last 20%... it's even more true about the last 2%, unfortunately. I'll poke at some more of these issues to see if I can find a solution to them, but I'm not sure I'll be able to get them all. |
That's great! We'd always prefer to retrieve / store / send the raw stream of data to avoid any potential unknown parser issues. Taking a quick look at the code for That said, I think fixing the no colon header issue may help ensure we don't unintentionally remove those portions of the headers (though invalid) when we export it back out since that's a case that's already been identified. Being able to rely on consistent newline behavior with the Header WriteToAsync may also be useful for the same reason when we merge back, but we'll likely double check and ensure that on our side anyway. Maybe we'll even just stick to adding only our expected headers to the very top of the existing headers thus leaving the existing headers format fully intact as well. |
Fixed the issue about headers that don't contain a ':' (or are otherwise invalid). |
Nice! Pulled the latest version from the MyGet feed and that test passes now. |
I've updated your original comment to add markdown checkboxes so that I can check off the issues that I have fixed. |
I've got a patch for your 3rd issue, but it breaks a load of other tests :-\ |
Since messages technically always need to end in CRLF anyway, I'm thinking we can probably dismiss items 2a, 3 and 5 in the list above. |
Our particular use cases are best solved via the Given those solutions, currently only the header fixes will have an impact on us, which have already been made. However, I think it might be useful on a future TODO list to consider having the library produce consistent and known behavior when it comes to newlines. For example, you could decide to ensure the |
I was going to implement the Send (Stream, ...) API but stopped because I need to figure out a few issues with that idea:
As far as this bug report, I guess I can close this now. |
I would expect the stream to be sent as is and the developer to have addressed any CRLF or other issues when the message was created via MimeMessage or otherwise. If one needs SmtpClient to modify it, they can and should use the MimeMessage overloads, which handle the CRLF issues in addition to other things such as line length issues via MimeMessage.Prepare, etc. |
Hi, any additional thoughts on |
Oh, hey, sorry. I ran into some other issues. There are a bunch of virtual protected API's that pass a In order to implement a |
I see what you mean. What would you suggest? We'll definitely want to implement this for our use case since:
Does it make sense to include as part of the library or would it make more sense for us to look at maintaining our own copy of |
Maintaining your own SmtpClient may be the best way. |
Since MimeMessage "attempts to maintain byte-for-byte compatibility with the original stream", I'm including test cases below where that fails.
The issues below are:
The issues below are:
The issues below are:
The issues below are:
The issues below are:
The issues below are:
Message after LINQPad property Dump:
The text was updated successfully, but these errors were encountered: