I have a program that sends out reminder based on an input file. Attached working version.
However, I would like to improve it by using get outlook mail to filer the email with “subject” and a “body”. The body has a text label “email”, not the From field. Then compare the excel email column with the mail messages and send a reminder.
you have to use Get Outlook Mail Messages or Get Exchange Mail Messages activity. Both as output returns list of mail messages. You can iterate through this list using for each, please use System.Net.Mail.MailMessage as TypeArgument for for each. You can view body using it’s property ‘.Body’, specified text in body can be found using regex (import System.Text.RegularExpressions namespace). Example: Sequence2.xaml (8.1 KB)
Thanks @p0tfur. I am not familiar with regex. Also, I am not looking for a text per se. I could use filter to do that like subject which I have done.
What I need is in the mail, there would be a text called Email. U see, it’s a form. So, I need to check for the value next to the Email label. I am not sure whether this is possible.
Then, with the email from the body, not From field, compare with excel column for email and send a mail to those who have not submitted their forms.
It’s an email that has text as attached. And the body text has Email label and the value contains and email address. This is so we could use it to compare with the excel input. Then for those who have yet to submit the form, to email reminder. Thanks !
Thanks @Palaniyappan. You are fast ! I will test it out. To send reminder, the send email should be in the else right I suppose as I try to figure your codes.
The condition item.Body.ToString.Contains(row(1).ToString) will meet when body email matches excel input email column.
So if i wanna send reminder to those who have not submitted, and therefore no email, then the send email activity should be placed in the ELSE cndition then?
It is not showing the expected results. Do you think we should use “not contain” instead of putting the send email activity in the ELSE condition.
Or should the excel be read first then loop thru the email messages ? Becos what we have now is for every email it will loop thru the excel again. So, the same person gets sent more than once for reminder. Thanks !
It is not showing the outcome. Sorry, the requirement is
(i) The excel file has a list of email.
(ii) And it is used to check against email messages for the body that contains the email address.
(iii) If there is no match, then the person in excel email address will be sent a reminder.
I have attached the pictures that show existing codes where it is reading email message; and for every message loop thru the excel to find a matching email address instead. Thanks.
I changed the logic to read excel for email. Then filter body for email address (excel input) using the get outlook message below
“@SQL=urn:schemas:httpmail:body LIKE '%” + row.Item(1).ToString + “%’”
But stranglly when I run it returns 0 count even when I message box out the reading of the excel input for the variable is correct. And I have email message whose body contains the emailaddress.
Does anyone know if the filter statement works ? I have used it for filtering subject without problem. Thanks.