How to check whether or not the email has got attachment

Hi guys,
i just wonder if there is a way to figure it out if an email has attachments or not?
I have already read this topic:
https://forum.uipath.com/t/how-to-find-out-if-mail-has-attachments-or-if-it-has-no-attachments/5080
but my problem is when there is an Image in signature, it is considered as attachment whilst there is no actual file attached to email. does anyone know what the solution is?
I am using Outlook Activity and getting first 30 unread emails.

1 Like

You can check the attachments file extension and exclude any img format extensions (. Png/. Jpg) etc in your check.

Not the prettiest way but a solution none the less.

1 Like

hi @TimK ,
thank you for your comment, what if the attachment is .JPG / .PNG etc. trust, i will miss them. to me it is safe and there should be a proper solution in place to ignore inline attachment(s) and focus only on normal/actual attachment(s).

@TheBestBirth Can you Check the attachment names and if the Signature Image Attachment has the same name always then you can ignore it.

@supermanPunch
unfortunately, the attachment names are vary and another thing there might be the case that name of Logo/signature is identical with attachment. so basically i am looking for a solution which is completely independent of Type/Name/size. simply differentiate between inline and normal attachment.

@TheBestBirth In that case I don’t know if there is a way to find the difference between them, but what you can do is, download the attachments if only there are 2 or more than 2 attachments since always one attachment will be the Signature one, In this way you can minimize the downloads. Then at a later Stage you can filter the attachments when you process it.

This is one work around for the situation, might not be completely good. But we can try and check for errors, or if you have noticed a flaw in this method, please address it.

@supermanPunch
this is also an issue in my case since we have a lot of emails without signature, some with and most of them have more than 1 image ( the ones i checked are up to 6-7 depends on company), and of course not all emails have attachment :slight_smile:
i see that it is getting a bit complicated … but i have a gut feeling that there should be a fairly simple solution for it since it is an essential thing when it comes to email handling.

@TheBestBirth I’m not really sure if there’s another method of saving the actual Attachments from the mail, Hence I’m providing another work around, I don’t know if you’d like to use it :sweat_smile: but it might be helpful.

It Involves two folders, one for the Actual Attachments and another for other Attachments.

Basically It saves all the Attachments of the mail at first, then it finds the attachments which are not needed and it moves the other attachments into another folder. Hence, Classifying the attachments into two different Folders.
In this way, you can process the Actual Attachments from the Folder you have specified in a later stage.

I thought of deleting the unwanted attachments but later I realised it would be better to Split it into two, So we can have a Copy of all the attachments :sweat_smile:

If you have found a better solution. Please post it.

Get Attachments.zip (2.3 KB)

There isn’t a way then, if your process knows what attachment types you require then you should be able to build it accordingly.

From the emails that you are receiving, are you expecting images etc?

The reason why the signiture images are as attachments is due to the sender not having the email format as HTML but plain text, unless you can ensure the senders of any of the emails you receive can send it as HTML, you could look at the content type of the mail message to see if it is (text/plain). If it is is plain text, then you can potentially assume the images are from signiture.

I feel like your looking for a blanket soultion when there probably isn’t one as this is with Microsoft.

You may need to add a few steps to your process in order to determine wheather or not its a genuine attachment or not

@TimK / @supermanPunch
Thank you both for the effort. in this particular RPA i am working on, it is not a big deal since i do not expect to get any .JPG/.PNG as attachment so that i can use filer etc to fix it. it just came out of my curiosity because i have some other RPAs in pipeline which then .JPG/.PNG will be part of the game and perhaps i need to play around with the process instead.
@supermanPunch, i assume the challenge here is how to find out which Image is main attachment and which one is part of Signature. (Maybe working around name/size can help )
@TimK , Thanks for the info. yes i am aware of it but usually we receive 200+ email per day from 70+ different sources and such which i cannot expect them to understand what we are talking about here :slight_smile:
i assume i need to get some part of it manually done (but i will take it when it comes).
Once again, Thank you both for your support and time,
have a lovely weekend!

2 Likes