Logout

Alt-N Discussion Groups > MDaemon Discussion Groups > MDaemon Content Filter > Deleting Duplicate Email in Public Folders

 [F] Alt-N Discussion Groups  / MDaemon Discussion Groups  / MDaemon Content Filter  /

Deleting Duplicate Email in Public Folders

[Caruth, Arron]
Arron Caruth
Administrator
Administrator
Posts: 1725
Arron Caruth - 12:05pm, Aug 10 2016

I wrote a PowerShell script that can be used in conjunction with a content filter rule to delete messages with the same subject.

 

The content filter rule is below:

 

[Rule004]

RuleName=New Rule #4

Enable=Yes

ThisRuleCondition=Any

ProcessQueue=BOTH

Condition01=SUBJECT|starts with|AND|Invoice|

Action01=run a program|"-1,0,0","C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe c:\temp\powershell\FindandDeleteMSG.ps1 "Subject=$SUBJECT$""

 

You’ll need to update the path to your powershell.exe as well as the path to the PowerShell script you are creating.

 

The PowerShell script is below:

 

foreach($arg in $args)

{

    if($arg -contains "Subject=")

    {

        $Pattern = $arg

    }

}

 

#Replace the value of the $Path variable with the path to the public folder to be searched.

$Path = "c:\mdaemon\public folders\company.test.IMAP\Test.IMAP\*.msg"

 

$Matches = Select-String -Path $Path -Pattern $Pattern

 

foreach($Match in $Matches)

{

    Write-Host $Match.Path

    Write-Host "Removing" $Match.Path

    Remove-Item -Path $Match.Path -ErrorAction SilentlyContinue

 

}

 

This script will not work if the subject is encoded.  It will only work if the subject of the email is in plain text and starts with Invoice.  You may need to tweak the script for your environment.

 

-- 

Arron Caruth
Director of Product Development
Alt-N Technologies
http://www.altn.com
 

Sent using Alt-N's own MDaemon Messaging Server   
Now available with  BYOD Mobile Device Management, 
Document Sharing, Hijacked Account Detection and more.

Get to know the Alt-N family by liking us on Facebook!

 

From: md-cfilter@altn.com [mailto:md-cfilter@altn.com] On Behalf Of sysadmin@sykestimber.co.uk
Sent: Wednesday, August 10, 2016 9:54 AM
To: md-cfilter List Member
Subject: [md-cfilter] Deleting Duplicate Email in Public Folders

 

Just wondering if anyone has found a way to use content filtering to delete an earlier email with the same unique subject line in a Public Folder when it is replaced with a later email with the same subject line?

The scenario is that an email with an attachment, a PDF invoice, is parked in a public folder through content filtering prior to checking. If there is an error on the invoice a revised invoice is raised and a new email with the revised invoice is, again through content filtering, parked in the same public folder. At this point the earlier timed and possibly earlier dated email with the same unique subject line needs deleting from the public folder, just leaving the more recent one in the folder.

The only unique information is the email subject line "Invoice nnnnnn", where "nnnnnn" is the unique invoice number.

From enquiries so far I am not at all sure this can be done but any thoughts would be welcome.


View/reply at Deleting Duplicate Email in Public Folders

 
 
--MD-CFILTER---------------------------------------------------------
This list is for questions and discussions about MDAEMON's Content 
Filter. To unsubscribe from this mailing list send an email to 
md-cfilter-unsubscribe@altn.com .
--POWERED BY MDAEMON!------------------------------------------------
 
---------------------------------------------------------------------
These forums are provided by Alt-N Technologies for user-to-user 
support and discussion.  Alt-N staff members may participate in the 
forums periodically but please recognize that this is not the official
method of receiving technical support. To receive personal technical 
support please use the form here:
http://www.altn.com/Support/RequestSupport/
---------------------------------------------------------------------

--MD-CFILTER---------------------------------------------------------
This list is for questions and discussions about MDAEMON's Content
Filter. To unsubscribe from this mailing list send an email to
md-cfilter-unsubscribe@altn.com .
--POWERED BY MDAEMON!------------------------------------------------

---------------------------------------------------------------------
These forums are provided by Alt-N Technologies for user-to-user
support and discussion.  Alt-N staff members may participate in the
forums periodically but please recognize that this is not the official
method of receiving technical support. To receive personal technical
support please use the form here:
http://www.altn.com/Support/RequestSupport/
---------------------------------------------------------------------

  All MessagesOldest ItemsOlder ItemsNewer ItemsNewest Items

(No messages yet.)

  All MessagesOldest ItemsOlder ItemsNewer ItemsNewest Items



 Content:

Read New | Search

 Guest:

Email to Admin



You are visiting as a Guest user.