How do I extract emails containing a specific subject

Good Morning,

I am working on a new little project. The gist of it is to extract emails that contain a specifc subject. If it contains that subject then you will grab certain contents from the email: item name, item number. with these I will upload to a site, so I think I may need to save it to a file and point to it when uploading. I am not sure how to approach this one. I started with get outlook mail message. Is this going to be something complex to accomplish? Let me know if you need anymore background.

Thank you!

@amb13 Let me give you all the steps.

  1. Get outlook mail message —give output as resultEmail
    2.Drag and drop foreach activity – goto properrty and change it to system.net.mailmessage
    3.pass the resultEmail in foreach
  2. Drag if activity and provide condition as - item.subject.contains(“word”).ToString

if further if u have to check any attachemt then add one more if condtion as item.Attachment.Any

Please revert if you need more assistance

Ahtesham

I had up to my if statement completed. Now how must I get the information from the email? From this information, I want to eventually upload it on a specific website if that makes sense?

@amb13,
Sorry i am not able to understand your question.

Email.xaml (9.6 KB)

I have attached sample .xaml file .please have a look and revert if you need more assistance.

Note - if you want to reply to me please prefix my name with @ so that i will come to know about your reply.
Thanks

Ahtesham

@md.ahtesham

I dont want it to produce message boxes. I want to read the emails that contain subject “load faileed”. In the body of these emails there is a table with item name and item number. This item name and number need to be extracted from the email and saved so that I can type this name and number into a site. Does that make more sense?

@amb13
I got your point. Thank you for detailed information.

I have already shared .xmal this will help you to filter mail with subject line.

For body part you need to do some operation. Since I don’t know how information are written in your body.
Your desired information might be in table , it might be written beside key word ( like item name : Laptop item number : 1234NJK )
Both these will have different extraction mechanism.

I can suggest you what you can do to get your desired result.
Item.Body.ToString – this will give you body , after that use regex expression to get your data.

Ahtesham

  1. save the email as a .mht file
  2. use StartProcess Activity to open the file open it With IE
  3. Using Data-scraping scrape the data from the table in the email into a data-table
  4. write data table to excel

@md.ahtesham
This is what is displayed in the email. I believe it is a table,so the first row is the keyword and then the second row are what describes the keyword(what i have to upload into another site everytime i receive this email). Do you have an extraction method for this?
image

Hi @amb13,

You can use ExtractStructured Data Activity to extract data table from .mht file.
Note: Open the .mht in Internet Explorer activity.

Best!!
Anmol

1 Like

@anmolk171
Its not an mht file its in an email.

@amb13 - You need to store that email in .mht format. You can do that using Save Mail Messages activity.

1 Like

Okay, then from this I will be able to point to the message and extract the data to upload onto the website?

@amb13 - Yes.