I am having a problem printing the filename on a condition.
I have successfully run the following code, which prints the entire two emails that are contained in the folder.
<br>use strict; <br>use warnings; <br>use Email::Outlook::Message; <br> <br>for my $filename ( glob("C:/path/to/folder/with/email/files/*.msg" +) ) { <br> <br> my $msg = new Email::Outlook::Message $filename; <br> my $mime = $msg->to_email_mime; <br>print $mime->as_string; <br>}
What I'd like PERL to do is read the file, search the body for the work "training", then print the name of the file only if the body contains the keyword.
One email contains the keyword and the other doesn't. Let's say the file names are "email 1.msg" and "email 2.msg". The first contains the work "training" in the body, the other doesn't. I want PERL to print only "email 1.msg" because it contains the keyword.
Seems I need to use an IF statement and =~/commit/ somewhere.
Note: the larger application will be to search thousands of emails within a folder.
Discipulus fixed code tags
In reply to Re^6: Reading msg file
by monkee
in thread Reading msg file
by shylaja
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |