How to send mail with list? And filter a specific keyword..?

Hi!

I created program that takes all of my mails, puts them to excel (with subject and body), counts how many emails I got and then comes the problem I have: if mail contains in subject or body a specific word (I have “HOKS”), it should put all the mails to a list and all other mails without keyword to another list. I tried doing this my it doesn’t work.

You can see my try doing lists from here: kurssi1.PNG - Google Drive

Here is my try sending the list with mail here:

Everything works until the second for each / creating lists.

  1. How to create a list that contains only mails with specific keywords?
  2. How to send an email that displays all the mails with “Hoks”-keyword’s subjects and all other emails without keyword’s subjects?

Help needed - really needed!

Regards,
Jennie

Hi Jennie and welcome!

I’ve seen from your process that you the problem might be in your condition:

you are checking if it contains “Hoks” but by doing ToUpper first your check will always be false.
image

A correct condition might be:
mail.Subject.ToUpper.Contains(“HOKS”)

Try this and see if it works :slight_smile:

Regards,
Stefano