Get embedded images from net.Mailmessage

Hi guys,

I use the activity “Get IBM Notes Mail Message” to receive mails.
The result of this activity is of type System.net.Mail.Mailmessage.

Is it possible to extract images embedded in a Mail (not attached)?
The E-Mail Body attribute is just an string.

Thanks,
Michael

@Michael_Pittner

Ideally the embedded images also will come as attachments can you please check

if the images are coming as url then you can extract the url and save the response of url using http request

cheers

There is no attachment available.

Where can I find the URL of the image?
In the E-Mail Body is just the E-Mail text included.

@Michael_Pittner

Print the body and check some times the image is embedded as url at that time we cna get it

else we cannot

cheers

Hi @Michael_Pittner

Extracting embedded images from an email’s body when using the “Get IBM Notes Mail Message” activity in UiPath can be a bit challenging because this activity returns the email body as a string, and embedded images are typically encoded as base64 within the HTML of the email body. To extract these images, you’ll need to parse the HTML content of the email body and then extract the base64-encoded image data.

Here are the general steps to extract embedded images from an email’s body:

  1. Get the Email Body: You already have the email body as a string.
  2. Parse the HTML Content: Since email bodies are often in HTML format, you’ll need to parse the HTML content to locate and extract the image tags.
  3. Extract Image Data: For each image tag in the HTML, you’ll need to extract the base64-encoded image data.
  4. Decode the Image Data: Once you have the base64-encoded image data, you can decode it to obtain the image in binary format.
  5. Save or Use the Image: You can save the extracted images to a file or perform any other desired actions.

Hi,

The following is a sample for extracting inline images from LinkedResorce. This may help you.

Sample
Main.zip (2.1 KB)

Please replace GetOutlook activity with Notes activity.

Regards,

I’m afraid I don’t have a HTML body. Because [Mail].isBodyHTML returns false.

thanks for your respons.
But there is no ‘alternateView’ available…

grafik

The issue was resolved using the Get IMAP Mail Message activity.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.