How to create .msg files using Aspose Email cloud API

I am fetching emails from my clients mailbox using ms graph and then saving them as .msg using Aspose Email Cloud API. Till now, I am able to handle the attachments and others.

However, when I am trying to open the saved msg file in Outlook, the body of the mail is not well formatted. The issues that I face in body are:

  1. Inline images/signatures are restored.
  2. Uneven spacing and lines.
  3. Any other formatting like, bold, italics, highlights are not restored.

Using this API: Aspose.Email Cloud - API References

Please suggest how can I resolve it. Thanks

@dheerajFirebase08

You reported that you are saving emails as .msg files using the Aspose.Email Cloud API and experiencing formatting issues in Outlook, such as problems with inline images, spacing, and text formatting like bold or italics.

When working with the Aspose.Email Cloud API, it’s important to ensure that the email body is correctly formatted and that inline images are properly embedded. Here are some key points to consider:

  1. HTML Structure: Make sure the HTML content of the email body is valid and uses correct HTML tags for formatting (e.g., <b>, <i>, <u>). For inline images, use the data:image URI scheme with base64 encoding to ensure they render correctly in Outlook .

  2. Body Type Setting: Set the BodyType property appropriately. If your content is HTML, set BodyType to Html. This ensures that the formatting is preserved during conversion to .msg .

  3. Image Embedding: If you’re including inline images, embed them directly in the HTML using base64 encoding rather than referencing external URLs. This helps maintain image visibility across different email clients .

While we don’t have specific code examples in the provided context, these general practices should help improve the rendering of your .msg files in Outlook. If the problem persists, please confirm whether the HTML content being passed includes proper formatting and image embedding techniques. A support engineer will follow up in this thread if needed.

I tried the suggestion but the issue still persist. Can I get more help on this?

I have shared a screenshot of original vs aspose created msg

image.png (61.1 KB)

Please let me know if additional information is required to help me walk through this blocker.

Hello @dheerajFirebase08,

Can you share the original message so we can test it?

Thank you.