Free Support Forum - groupdocs.com

View email along with the attachments using C#

Hello,

When converting an email (msg) to PDF using GroupDocs.Viewer (19.12.1), images are the only attachments that get converted to PDF as well.
The GroupDocs.Viewer is capable of handling so many formats, why are only image files converted?
Is there a way to control the behavior and is this somewhere documented?

At the moment I would have to guess / assume that I have to call SaveAttachment and tell the Viewer to convert everything that is not jpeg, jpg, png or bmp… which is not great.
Could this please be improved?

image.jpg (468.0 KB)

I was testing how the Aspose Email Viewer handles an email with a jpeg, a pdf and a docx attachment, but it was also not satisfactory.
Like in the GroupDocs Viewer, only the image was included in the conversion and when scrolling further down, conversion for the attachments was triggered later, leading to a duplicate image and was failing for the other two attachments for an unknown reason.

@Clemens_Pestuka,

Please share following details, we’ll then investigate this scenario:

  • Problematic email (msg) file with attachments
  • Sample code that you are using

Do you mean 19.12?

@atirtahir3
Thank you for taking a look at this issue.

Yes, I also tried with 20.1 now, but nothing changed.

I could not upload the same msg file due to upload size limitations, but it happens with any email:
Inconsistent behavior handling email attachments.zip (2.7 MB)

I was using the Basic PDF Render sample for converting the msg file.

1 Like

@Clemens_Pestuka,

This issue is reproduced at our end. Hence, we’ve logged it in our internal issue tracking system with ID VIEWERNET-2306. As there is any update, you’ll be notified.

1 Like

@Clemens_Pestuka,

Please note that this is API’s default behavior. You cannot render attachments in the source email file.

We will disable rendering of image attachments to avoid confusion. So, next time your will render an email message the output PDF/HTML won’t contain image attachments.

To render email attachments it is necessary to save attachment first with SaveAttachment method and render it with new instance of Viewer class.
Please check this example that demonstrates how to render email attachments.

@atirtahir3
Thank you for taking care of this issue :slight_smile:

Actually it would be even better / more important for us, if the Converter,
which already ignores the attachments and only converts the email,
would offer “EmailOptions” like the viewer for translating subject, sender,…

We would need this EmailOptions for PdfConvertOptions as well as for ImageConvertOptions.
Would it be possible to add this?

1 Like

@Clemens_Pestuka,

We are investigating this. You’ll be notified about the outcomes.

1 Like

@Clemens_Pestuka,

GroupDocs.Viewer for .NET doesn’t support such Classes. However, PdfConvertOptions and ImageConvertOptions are available in GroupDocs.Conversion for .NET API.