I have a scanario to download attachments in mail.
Scanario-1:
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.
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.
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)
Example:
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.
@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 @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.
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