Aspose email attachment extraction

Hi guys need your help
Recently I uploaded email with attachment it extracts including metadata ( .txt and docs )and attachment
is it possible can extract only attachment

@Nathangr

Can you please clarify if you are using a specific Aspose.Email method for extraction and what type of attachments you are trying to extract?

We use aspose email parse API

we try with .eml and msg both we received html, txt, doc format of that mail
actually we only want that extracted attachment only

Hello @Nathangr,

Could you clarify where exactly you’re getting the message from? For example, are you loading it from a .eml or .msg file, or are you working with PST files or a mail server? This will help better understand how to adjust the code to extract only attachments.

It would also be helpful if you could share a sample of the code you’re trying to run, so we can give more precise suggestions.

Thank you.

1 Like

In our web application, when we upload EML and MSG files, we send them to Aspose via their API. Aspose Email Cloud API extracts the attachments and returns the files to us. However, it also sends back HTML, .txt, and DOC files, which contain the body of the email

@Nathangr .

You still haven’t mentioned the method you’re using. We suppose EmailApi.FromFile method can solve your problem. This method converts an Email file (eml, msg, …) into an EmailDto object containing all the information from the email. The object will have an Attachments field that includes only attachments.

One of the attachment fields, Base64Data, holds the file contents in Base64 format. You can easily transcode this to retrieve your attachments in their original form.

Attachments also have Name field that holds a file name.

If you still encounter the same problem, please provide us the name of the API method you’re using with the reference to it (the precise URL). If you’re using SDK, please write the name of the method like this: EmailCloud.EmailApi.FromFile.