41587 + 41590 Not fixed

Hi,
Both cases were wrongly claimed to get fixed, run the sample and see both issues:

The 1st one still has:
< ! --[if !SupportsSharedCalendar]-- > Accept and view calendar
< ! --[endif]–>

The 2nd one does not render the header image at the top of the page!
Thanks.
WinApp41587+41590.zip (4.2 MB)

@australian.dev.nerds

Cause

The issues you reported regarding the rendering of calendar text and header images have not been resolved as expected. The calendar text not displaying correctly may be due to conditional comments not being processed properly. The header image not rendering could be related to how images are handled in the document.

Solution

  1. For the Calendar Text Issue: Ensure that the conditional comments are supported in the context where you’re rendering the document. Check if the rendering engine or the version of the library you are using supports these comments.

  2. For the Header Image Issue: Verify that the image path is correct and that the image is accessible. If the image is linked via a relative path, ensure that the base URI is set correctly when loading the document.

Code

Here’s a basic example of how to set the base URI when loading a document that contains images:

LoadOptions loadOptions = new LoadOptions();
loadOptions.BaseUri = "path_to_your_images_directory"; // Set the base URI for images

Document doc = new Document("path_to_your_document.docx", loadOptions);

Next Steps

  1. Run the sample code with the correct paths and ensure that the images are accessible.
  2. If the issues persist, check for updates or patches for the library you are using, as these might address the rendering issues.
  3. If you continue to experience problems, please provide additional details or a sample document that reproduces the issue, so we can assist you further.

Please let me know if you need any further assistance!

First, the issue with extra characters such as <!--[if !SupportsSharedCalendar]--> We have reviewed the original scenario you described (PST → MemoryStream → MailMessage → HTML), and we confirm that this issue has been fixed in version 25.6.

Regarding your current observation where similar strings appear in the body when saving the message as EML, we have re-checked this case on our side. When the saved EML file is opened in Outlook, the message body renders correctly without showing these conditional comment strings.

This behavior is expected because such conditional comments are part of the original message body in some Outlook-generated messages.
They are used to control how the content is rendered in Outlook or other clients that support Microsoft conditional HTML. These parts may still exist in the raw MIME body (EML), but Outlook ignores them during rendering.

If you’re opening the saved EML file in a plain text viewer or email client that does not parse conditional comments, then these strings might appear – but that is outside of what we can control from the library side, since the EML format is meant to preserve the original MIME content as-is.

Please let us know if you’re seeing different behavior in Outlook specifically, and if so, share the exact steps and environment so we can investigate further.

Regarding the second issue, where image not being rendered.

The SetHtmlBody method only sets the message body as plain HTML content. It does not process any inline images in the HTML.

If you want the HTML content and its embedded images to be handled correctly (preserving inline images as part of the message), please use the following approach instead:

var eml = MailMessage.Load(@"Bug.html", new HtmlLoadOptions());
eml.Save(@"out.eml");
1 Like

Thanks, for the extra chars issue, is not my concern, just wanted to let you know, but I still think that your argument is not wise, because:
If we export it as Emlx, the same result with extra chars! Outlook does not open Emlx hence why you expect the Apple Mail to process those conditional comment strings?
If we export it as Html, the same result with extra chars! Outlook does not open Html hence why you expect the Mozilla Firefox to process those conditional comment strings?
If we export it as Text, the same result with extra chars! Outlook does not open Text hence why you expect the Notepad to process those conditional comment strings?
Even when we save it as Eml, which is not the native supported format by Outlook, so I used Microsoft Mail app and it showed up.

Anyway, I’ll leave it to you since just wanted to let you know about it.

About the html inline images issue, most of the times, it’s not a file on disk, but a string containing the Html and relative files encoded inside as Base64.

I think load resources in SetHtmlBody method was an implemented request, this feature seems critical to me but I might be wrong, so please advise how to load Html to your MailMessage/MapiMessage from base64 encoded string efficiently? Without saving and loading back from disk?
Thanks

Hi,

Thanks for the clarification. We now understand that this was not a formal issue report, but rather an informal “just letting you know” comment.
However, in that case, we would like to highlight a few important points:

  • If full and accurate behavior across formats like EMLX, HTML, TEXT, and EML is critical to your use case, it would be far more helpful and efficient for everyone if you provided a clear and complete description upfront. This includes the exact formats you’re using, the applications where you observe issues, and a sample project with reproducible code. Otherwise, we are left to guess what the actual concern is, and spend time chasing incomplete information, which is inefficient for both you and us.

  • Please avoid mixing multiple unrelated issues in a single forum thread. It creates confusion, requires extra effort on our side to extract and separate the problems, and leads to less productive communication.

  • If your input lacks context or precision, it directly impacts the quality and speed of the response and fixes from our development team.

  • Regarding the inline images in HTML, you initially stated the issue using a file, and only now clarified that you’re working with a string. That’s a detail and should’ve been shared from the start.

  1. To answer your question: if you have an HTML string and resources encoded inside, you can convert it to a MemoryStream and load it using MailMessage.Load. There’s no need to write to disk. Here’s an example:

    string html = /* your HTML content as string */;
    byte[] htmlBytes = Encoding.UTF8.GetBytes(html);
    using var stream = new MemoryStream(htmlBytes);
    var message = MailMessage.Load(stream, new HtmlLoadOptions());