ioliver Posted December 8, 2005 Share Posted December 8, 2005 Here's a script to look through the messages that IMF blocks, and search for a specific email address in the x-sender line, in this case it looks for the address '@ms.com'.It will need to be modified for your use, but it works well. Thanks to cameronsdad for helping me with this.Here's the code:expandcollapse popup$dir = InputBox("Search IMF for @ms.com.com", "Full Path to Directory:") FileChangeDir($dir) DirCreate($dir & "\xp") $output = FileOpen($dir & "\xp\SearchIMF.txt", 2); Opens for writing SplashTextOn("Search IMF is looking for messages from @ms.com", "Searching file: ", 350, 20, "", "", 22, "", "10") $search = FileFindFirstFile("*.EML") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $x = 0 $file = FileFindNextFile($search) If @error Then ExitLoop ; MsgBox(4096, "File:", $file); Uncomment to test script $EML = FileOpen($file, 0) ; Check if file opened for reading OK If $EML = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ControlSetText("Search IMF is looking for messages from @ms.com", "", "Static1", "Searching File: " & $file) ; Read in lines of text until the EOF is reached, or until "x-sender:" is found While 1 $line = FileReadLine($EML) If @error = -1 Then ExitLoop ; MsgBox(0, "Line read:", $line); Uncomment to test script If StringInStr($line, "x-sender:") And StringInStr($line, "@xpsystems.com") Then ; MsgBox(0, "Search IMF.au3 found an email from @ms.com", $file); Uncomment to test script $x = 1 ExitLoop Else $x = 0 EndIf WEnd FileClose($EML) If $x = 1 Then FileWriteLine($output, $file) FileMove($file, $dir & "\xp\" & $file) EndIf WEnd SplashOff() FileClose($output)Thanks for reading. Please let me know if there are any comments or questions.Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now