Hello,
In the attached zip there are two files. One of them is the input EML file and the other is the MHtml, which is produced using Aspose.Email. The text on the third page is cutoff and cannot be read correctly. It is also reproducible in your online Viewer.
Screenshot:
image.jpg (118.2 KB)
Summary
When an EML file is saved as MHTML with Aspose.Email, the library wraps the message body in a fixed‑height HTML container. If the original message contains more content than fits in that container, the overflow is hidden, so the third‑page text is cut off in the resulting .mht file and in the Aspose online viewer.
Why it happens
- Aspose.Email’s default
MhtmlSaveOptionsgenerates a<div>(or similar element) whose height is set to roughly one printed page. - The generated CSS uses
overflow:hidden, so any content that exceeds the container height is not rendered. - This behavior is part of the current MHTML conversion implementation and therefore appears for long plain‑text bodies or large tables.
What to do next
- Upgrade to the latest Aspose.Email build
- New releases often contain fixes for rendering issues.
- Use NuGet to get the most recent version:
Install-Package Aspose.Email
- Ensure the message body is HTML before saving
- If the original EML is plain‑text, convert it to HTML yourself so the content is not placed inside the fixed‑size wrapper.
// Load the EML
var msg = MailMessage.Load("input.eml");
// Convert plain‑text to simple HTML (preserves line breaks)
if (!msg.IsBodyHtml)
{
var html = $"<pre style=\"white-space:pre-wrap;\">" +
System.Net.WebUtility.HtmlEncode(msg.Body) +
"</pre>";
msg.IsBodyHtml = true;
msg.HtmlBody = html;
}
// Save as MHTML using the default options
msg.Save("output.mht", SaveOptions.DefaultMhtml);
By providing an explicit HTML body, Aspose.Email writes the content directly without the height‑limited wrapper.
- Post‑process the generated MHTML (optional)
- Open the .mht file in a text editor, locate the CSS rule that sets a fixed height (e.g.,
height: 842px; overflow:hidden;) and remove or change it toheight:auto; overflow:visible;. - This manual tweak removes the clipping without needing to change code.
- Use PDF as a reliable alternative
- If pagination must be exact, convert the message to PDF instead of MHTML. PDF rendering does not rely on a fixed container.
var pdfOptions = new PdfSaveOptions(); // from Aspose.Email
msg.Save("output.pdf", pdfOptions);
- Collect information for further investigation (if the problem persists after the steps above)
- Record the exact Aspose.Email version you are using.
- Keep the code snippet that creates the MHTML.
- Provide a minimal EML sample that reproduces the cut‑off.
With these details you can raise an internal issue with the Aspose development team, who can examine the rendering logic in a future update.
Follow the numbered actions in order. If the third‑page text is still missing after trying steps 1‑4, gather the information listed in step 5 and forward it to the internal Aspose support channel for deeper analysis.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
I would prefer a human answer instead of an AI one. As I said the issue can be reproduced in your Viewer (Word, PDF Viewer Online). I suspect that this is a bug in Aspose.Email and would like to have a confirmation and if possible an ETA for a fix. Thank you.
Hello @DWProject,
Thank you for pointing this out.
Aspose.Email doesn’t modify or reformat the original message body when converting to MHTML. The content is taken as-is. The cutoff you’re seeing appears to be related to how MS Word renders MHTML files, as it applies fixed page width settings by default.
If you open the same MHTML file in a web browser such as Internet Explorer or Edge, you’ll notice that the content displays correctly without any truncation. Alternatively, adjusting the page width settings in Word should also resolve the issue.