Read Email body of all the unread email

Hi all,

I am using “Get outlook mail message” activity to read mails. I want to read mail body of all the mail one by one present in my inbox.

Currently to achieve this I am using “For Each” loop and to get the body I am using mailmessages.FirstOrDefault().Body

But in this case i am always getting only the top most mail body.

Please help me to achieve this for all the emails in “Inbox” folder.

you can access those like in this picture above.

2 Likes

what is “mail collection” here?

it is an variable type like array of mails or List of mails.

I am taking output of the activity in a variable “ListGetMail” but when am trying to fetch body or subject line I am getting validation error.

2 Likes

Argument type of ‘for each’ activity should not be what I see in Screen shot. instead use System.Net.Mail.MailMessage

refer:

Regards,
Vikas Reddy

4 Likes

Hi @akhi_s27 @ranjith @manasa @

image

can anyone get the solution for this issues !!!

while i am using Get Outlook mail Message Activity in that property Mail Folder i have gave command as “Sent Items”
Error : The specified folder not exists.
But in My outlook folder are available : image

Regards
RaviDevaraj

@RaviDevaraj Are you sure it is connecting to your correct mail account (if you have multiple in the same outlook)? If not, have you tried specifying the account anyways to see if that corrects the issue? I could only get this to occur by putting an invalid account name into the “account” input property of the Get outlook mail messages activity which gave me an error “specified folder does not exist”.

i didnot gave an account id in that field

Does it work on other folders without the account property supplied? Try setting the property to the email account you wish to pull sent items from, do you get the same result?

1 Like

Yes, image

please find the WF : OutlookSample_v2.xaml (8.1 KB)

There is nothing in the “Account” property in either the attached workflow or your screenshot. Are you sure you’ve tried putting your email address (or the one you want sent items retrieved from) in the “Account” property of the Get outlook mail messages activity?

Your workflow works fine for me (accept the Connect activity which I wouldn’t expect to work) even allowing me to pull sent items from any of the accounts I have setup in my outlook client (upon switching the account named in said property).

Hi @Tyler_Williams
i have given my account id with and without its not working for me
Throws an error only : an error “specified folder does not exist”.

Hi @Tyler_Williams
Any possible there to overcome this problem ?

When you say account id are you meaning your email address similar to, yourname@domain.com? I’ve only ever supplied an email address or left the property blank. Are you able to access the inbox folder or any other folder successfully?

I can also generate this error by supplying a dummy email to this property so I suspect UiPath is not properly connecting to Outlook (I believe these activities require it to be installed an configured). Have you tried exchange or any other mail activities besides outlook as a workaround perhaps?

yes

No

No.
so there possible to get any solution for these !!!

I want to read my mail all inbox mails one by one. And while selecting one mail we have to read the mail and extract some data& do the processing of that mail.
And after that read the second mail from inbox and do the processing as mentioned above.

Continue the same task for all unread mails.

We already tried GetOutLook activity also.It is taking all the unread mails simultaneously. But i want to read and process one by one.
How can i do this?

Hi Ajisha,

GetOutlook activity will give you all mail that true but it is up to u how to process.

Use for-each loop to read mail one by one and process it.

Thanks
Vivek S.

Can you please add your worksheet it will better to provide exact solution

I am using GET IMAP to retrieve inbox messages. When i try to get the body the body is accompanied by html contents. How to retrieve only the body without those elements.