How to read Outlook Mail from Particular Sender

Hi Team, My requirement is to read a particular email from a specific sender. However, I tried using [SenderEmailAddress] = 'no-reply@microsoft.com' in UiPath C#, but it is not working. Can anyone help me with this?

Regards,
Sai.

Hi @Mada_Sai_Krishna

use the following expression in the Filter property of the Get Exchange Mail Messages activity:

"[SenderEmailAddress] = 'no-reply@microsoft.com'"

This will ensure that only emails from the specified sender are retrieved. Adjust the email address as needed for your requirement.

Found helpful, mark as a solution thanks

@Mada_Sai_Krishna

If you need more help related to filter follow below link:

@prashant1603765,

II have tried this, but it’s not working.

share the full workflow screenshot

@Mada_Sai_Krishna

Tested and working fine

Use below expression

“@SQL=urn:schemas:httpmail:fromemail LIKE ‘%yourmailid@outlook.com%’”

Detailed Steps:

Inside the filter option - the expression is

Can you please send in C#

FYI

Hi @Mada_Sai_Krishna

Try this:
Pls copy past there same
“[SenderEmailAddress] = ‘no-reply@microsoft.com’”

“@SQL=urn:schemas:httpmail:fromemail LIKE ‘%no-reply@microsoft.com%’”

I need to paste both

no only one

“[SenderEmailAddress] = ‘no-reply@microsoft.com’”

no facing same issue

Is your outlook configure correctly ? if yes, What error are you getting share the error screenshot

I’m able to read emails based on date, time, and the last 100 emails. However, when I try to read emails from a specific sender, I face an issue. There is no error, but it does not retrieve emails from that particular sender.

Hi @Mada_Sai_Krishna

Check with other sender mail with using previous syntax.

Or try there
“@SQL=urn:schemas:httpmail:fromemail LIKE ‘%no-reply@microsoft.com%’”

I have tried multiple sender mails also but still same issue

Hi @Mada_Sai_Krishna

Try below full steps and test:

first, drag and drop the Get Outlook Mail Messages activity into your workflow and set the MailFolder property to “Inbox” and the Top property to the desired number of emails, storing the output in a variable like allEmails . Next, add a For Each activity to iterate through allEmails , ensuring the TypeArgument is set to System.Net.Mail.MailMessage . Inside the loop, include an If activity with the condition email.From.Address = "specific_email@example.com" to filter the emails. Finally, in the Then section of the If activity, add the necessary actions to process the filtered emails, such as reading their subject or body.

@Mada_Sai_Krishna,

Kindly share what you tried and what went wrong to advise more specific.

This should work irrespective of your project is in C# or VB

Kindly confirm following

  1. Is it working fine without filters? I mean after removing filter - are you getting the mail count as 10?
  2. Is your expected email in Inbox folder only. Check and confirm it is not moved to any sub folder
  3. Is the expected email is there in the first 10 mails? As you have given filter of new 10 emails only, I would suggest you to change the count to 100 and check one more time

@ashokkarale,
My requirement is to read emails only from the sender email ID abc@outlook.com. I tried using the filter option with “[SenderEmailAddress] = ‘abc@outlook.com’”, but it’s not working.