EMAIL IMAP IF Else .from .subject showing No item

Hello Rookies,

i am very new in UiPath.
objective: to read table in the email body sent by specific sender.

in for loop, if sender sent email > then copy the text(table) in her email.
i already set my for loop type argument as: system.net.mail.mailmessage
but still .from or subject still not appearing. what am i missing?

thank you to anyone that will give guidance.

lyn

1 Like

Hi
Welcome to uipath community
It looks good actually
Fine
Let’s do one thing remove that for each activity and place a fresh for each activity and pass the output variable of get outlook mail activity and change the type argument as SYSTEM.NET.MAIL.MAILMESSAGE and inside the if condition mention like item.From or item.Subject methods

Or
To be very simple we can use this condition in the get outlook mail activity itself with a property called FILTER where we can mention likel this
“[From] = ‘your username’ “

This would filter in the outlook itself

Hope this would help you
Cheers @bri

i cant use outlook for now because we have office authentications before accessing our company outlook. that is why im trying in gmail for now.

1 Like

Heyyy @bri

Simple thing there, IF condition needs the boolean , but you are giving the string there , I mean mail.From is a string,

just complete it and check as

mail.From = "Somemaildid@gmail.com" and then check

Hi @bri,
Try using mail.fromSenderAddresss.contains(“your email id”)

Fantastic
Then we have two options here
If we have a username brimail with mail I’d like brimailid@gmail.com
Either we can use this expression like inside the for each activity
item.From.ToString.Equals(“brimail”)
Where item is the variable from for each activity and FROM is a method mail.mailmessage class
And from method can take only the mailid username and not the mail id

Or

We can mention likewise
item.Senderemailaddress.ToString.Equals(“brimailid@gmail.com”)
Where senderemailaddress is a method that takes mailid and not the username of the

Based on the output Boolean that comes out of any of these two options it will go to THEN or ELSE part
Of if condition

Hope this would help you
Cheers @bri

my for loop cant recognize .From.ToString.Equals
this syntax. its saying “NO ITEM” thats the issue.

1 Like

No worries
Can I have that screenshot if possible
Cheers @bri

1 Like

this is resolved by.
removing the activity, and freshly assign the variables again.
assign system.net.mail.mailmessage in for loop.

this is the condition that work in my if else: item.From.Address.toString.Equals("usename@gmail.com")

2 Likes

Fantastic
Cheers @bri