|
I'd like to load an EML file and get a .net string representing its raw contents after it's been read with the correct text encoding. This works for a simple example:
But will not work for files that have mixed character sets. I also looked at the MimeEntity.ContentString, but that no longer includes the headers and boundaries. Is there any way to get the entire, parsed message contents as one string? |
|
This is a difficult question to answer! :-) If all parts of the message only use If one or more message parts use So this leaves us with two options: 1) Get a .NET string representation of the message contents. This would be somewhat readable, but not necessarily a raw representation, as explained above. Also, when saved to a file, it would not produce a MIME-compliant message identical to the original one. 2) Find all message parts that use 8bit or binary content-transfer-encoding and change it to quoted-printable or base64. Find all improperly-encoded headers and fix them to be MIME-compliant. Then, save the message into a If you like any of these options, please let me know. We can write some code that demonstrates how to do that. By the way, why do you need a string representation of a MIME message? An answer to that question might help in finding the best solution. Thanks for the detailed answer. I think you're right - it's not reasonable to keep the message around as a simple string and instead we will use your component to store all the parts in the right encodings as a MimeMessage object to ensure everything is kept in place.
(12 Dec '11, 15:30)
powlette
|