I messed around with this a bit tonight and I think I have something that will work for you. I ended up with 2 content filter rules and a powershell script...
Create rules similar to the following:
[Rule007]
RuleName=List Grabber
Enable=Yes
ThisRuleCondition=Any
ProcessQueue=BOTH
Condition01=body|all message|AND|
Action01=run a program|"-1,0,0","C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File c:\temp\FilterlistMail.ps1 $MESSAGEFILENAME$"
[Rule008]
RuleName=ListChecker
Enable=Yes
ThisRuleCondition=All
ProcessQueue=BOTH
Condition01=body|process exit code|AND|=|1|
Action01=move to public folders|"test.com/Messages"
You'll want to add a condition to the ListChecker rule to look for words from a file in the message body.
Then copy the script below and put it into a PS1 file. The ListGraber rule is expecting the script to be at c:\temp\FilterlistMail.ps1, you can put it anywhere you'd like, the path used in the rule needs to be the same as where you put the file on disk. Then edit the script and change the $ListEmail, $LogPath, and $InboundPath variables to match your server. The $InboundPath variable needs to have the \* on the end of it.
If you don't want logging, comment out the Start-Transcript and Stop-Transcript lines by adding a # at the beginning of the line.
## MDaemon Technologies offers no warranty, provides no support, and is not responsible for any damages that may be arise ##
## from the use of this script. Use at your own risk. ##
param(
[string]$MSGFileName = "C:\MDaemon\Queues\Inbound\md5001000000432.msg"
)
$REGEX = '(\d{1,3}\=)(.*)(\s)(.*\s)'
$ListEmail = "listname@domain.com"
$LogPath = "c:\temp\FilterListMail.log"
$InboundPath = "c:\mdaemon\queues\inbound\*"
Start-Transcript $LogPath
Write-Host "MSGFileName: $MSGFileName"
if($MSGFileName -like $InboundPath){
$CTLFileName = $MSGFileName.Replace(".msg",".ctl")
Write-Host "CTLFileName: $CTLFileName"
Get-Content $CTLFileName | Select-String -pattern $REGEX | ForEach-Object {
$Recipient = $_.matches.groups[2].value.Trim()
Write-Host "Recipient: $Recipient"
if($Recipient -like $ListEmail){
Write-Host "Message found to $ListEmail"
Stop-Transcript
Exit 1
}
}
}
Stop-Transcript
Exit 0
If you haven't used Powershell on the MDaemon server, you'll need to set the execution policy. The easiest way to do that is to add
" -ExecutionPolicy bypass" to the end of the command line being called by the List Grabber content filter rule.
This script has had very little testing so I'd highly reccomend that you test it before running it on your live system.
## MDaemon Technologies offers no warranty, provides no support, and is not responsible for any damages that may be arise ##
## from the use of this script. Use at your own risk. ##
Let me know if you have any questions.