Free Support Forum - groupdocs.com

How to handle attachments when converting an email file to PDF in .NET

How can I handle attachments in GroupDocs.Conversion? In GroupDocs.Viewer, as a workaround, i can extract the attachments from f.ex. a MSG and can convert them seperately and merge them later to the PDF. How can i do the same in Groupdocs.Conversion? It does not seem to have any options to access the attachment of a document.

Thanks!

1 Like

@wolfgang.gogg,

We are investigating this scenario. Your investigation ticket ID is CONVERSIONNET-3533. As there is any update, you’ll be notified.

Any updates on this?

1 Like

@wolfgang.gogg,

This feature is not yet supported by the API. However, it will be implemented in some upcoming releases (v20.1 most probably). As the new release with this feature gets on-board, you’ll be notified.

Hello,
is there any rough time frame we are talking about here? Next month, next quarter, …?
We need to plan if we need to implement our functioality using the Viewer or the Conversion API. Any drawback of the Viewer API over the Conversion API?
Thanks!

@wolfgang.gogg,

We are currently working on this scenario. You’ll be notified about the ETA.

GroupDocs.Viewer is basically a document viewer API. It renders a document in HTML, PDF or Image format and later you can view that document in your application.
On the other hand, GroupDocs.Conversion is a document conversion API that performs back and forth conversion for over a multitude of file formats (e.g. convert a Spreadsheet to Presentation and vice versa).
In GroupDocs.Viewer you can only convert/render a supported document to PDF, HTML or Image format.

Hello,
So if conversion of supported formats to pdf is our main use case the viewer api does not have any drawbacks,correct?
Thanks.

1 Like

@wolfgang.gogg,

Yes, there’s no drawback.

@wolfgang.gogg,

Using GroupDocs.Conversion for .NET 20.1, you can now handle email (e.g. msg, eml) attachments as follows:

var source = "sample-with-attachment.eml";
var loadOptions = new EmailLoadOptions {ConvertAttachments = true};
using (var converter = new Converter(source, () => loadOptions))
{
    var index = 1;
    var options = new PdfConvertOptions();
    // Note: index = 1 is the email itself, all following indexes are attachments
    converter.Convert(() => new FileStream($"converted-{index++}.pdf", FileMode.Create) , options);
}

Please have a look at the release notes.