How to ignore attachments(images) embed in mail body

Hi Team,

I have a scanario to download attachments in mail.

Mail have 1 PDF attachment in mail but If we check MailVariable.Attachments.count, result with be 2.
Later me check the issue, then noticed in mail body sender signature is an IMAGE.

I need download only the actual attachment need to ignore embed images in mail body, looking for exports suggetions.


  1. I’m using OUTLOOK activity
  2. Actual result:
    1. Whitepaper.pdf
    2. Image- xsddd.png
  3. Expected result:
    1. Whitepaper.pdf


Welcome back to our UiPath community.

Note: In Filter property of Save Attachments activity mention like this "(.pdf)"

Our objective is to download all attachments ie., PDF, Excel, PNG or JPG.
But need to avoid images embed in mail body.


I think you have two options:

Option 1 - Update filter for multiple ‘approved’ types:
Further to @lakshman’s post.
In Filter property of Save Attachments activity can you try this "(.pdf|xls)"

Simply add a pipe “|” symbol when you need to add more filetypes.

Take a look here:
Save Attachments About the files extensions - News / Tutorials - UiPath Community Forum

Option 2 - Save all attachments then delete ‘not approved’ (unwanted) file types.
Step 1: Save all attachments
Step 2: Use Assign Activity to collect ALL files

Left Assign:
Arr_Files (array of string)
Right Assign:
Directory.GetFiles(InsertxFolderpath, InsertxFilexSearchPattern)

Directory.GetFiles(“G:\Yourfolder\RPA”, “*”)
Take a look at post
Step 3: Use a For Each and an IF activity to delete the “.PNG” or other unwanted file types.

You will need to download all attachments.

Hopefully this helps you.



1 Like

@VISHNU07 That is Okay. Let it download the images. Once the attachment download completes check is there any files other than .pdf extension . If there are any delete those files from the folder using delete activity

Hi @ushu and @Steven_McKeering

My scanario is I can download all types for file attached in mail, but need to ignore images embeded in mail body.

Below is my sample Mail

Robot execution log

Output Downloaded Files

In this example only the files 1,2 and 3 are required.
File 4 is from mail body, so not required.

Note: File 4 is embed in mail body


In Filter property of Save Attachments activity can you try this "(.pdf|txt|.jpg)

As per your screenshot example, it will download files 1-3 but not 4.



Hi @Steven_McKeering

Thanks for response :blush:

THe about scanario is an example, sometimes we may get other formats also in attachment.

File 4 is png format, sometimes png format file comes as actual attacment ie. file 3 may me png format instead if jpg format.


I guess signature image name constant here. If yes then delete that file whose name starts with Outlook-ug after saving all attachments.


Okay, I think I understand more now.

You need to remove the signature block image and keep the ‘real’ attachments. So it may not always be “.png”.

This is hard to do because it may not always be .png. But maybe you can use the file size also?

Is this correct?

Thanks, I check this before.
Its always not the same sign in file name.

Hi @Steven_McKeering

Yes, your understanding is correct now.

I looking for more effective solution.

If I got any will updated you.

1 Like

Sounds good @VISHNU07

I would be interested in that solution too! :wink:


Can you please run the process 2 to 3 times and show me the output here. I need to check how filename looks everytime.

Hi @VISHNU07 , I got into the same problem and haven’t found the best solution for that. But one way to solve this is to save all attachments and then loop through all attachment names.
Images embedded in mail body usually have name like “image1.img”, “image2.img”, … I used Exchange, it could be something else with Outlook in your case. I just delete all attachments with names like that (using Regex) and consider the rest of them as real attachments.

Hi @tranthao240495

Thanks for your solution, it will work sure.
In my case, sometime i may receive image as real attachments.
If real Image attachment file name start with image*** will be removed, I need it

that’s why look our community friends suggestion.

Hi All

This issue was addressed in Uiapth Mail Activities Pack Version 1.15.1 attached release note link for more details.

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