Solved

How to delete Specific email from Sent Items of Outlook for specific users with Exchange

Posted on 2011-09-15
21
384 Views
Last Modified: 2012-05-12
We have an exchanger server 2007+ and outlook 2007 and we are trying to find a way to delete from the sent items folder specific sent emails not all sent items folder and also do this for specific users.

Is there a way to do this action by creating a rule or something?
0
Comment
Question by:WINBRO
  • 11
  • 7
  • 3
21 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 36542382
Sounds like you got something to hide and would be a bad thing to do to me.
0
 

Author Comment

by:WINBRO
ID: 36542402
yes i dont want the users to see an auto generated email. We are sending an email for a program that has credentials for the client and the users should not see it.

We made something like a another email for the user have them send it automatically with the sender being that email and the receiver the client. But the problem is that it is show in the users sent items.

So i was asking this to detect a token in the subject and everytime it sees it in the sent iteems the exchange server and outloook will delete it permanttly from the sent items folder.

IS that possible?
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 36542649
Hello,

You can use the Export-Mialbox command to search for and delete specific emails from mailboxes.

http://technet.microsoft.com/en-us/library/bb266964(EXCHG.80).aspx

JJ
0
 

Author Comment

by:WINBRO
ID: 36542700
i need to do this automatically and instantly.  Can i do this and have it run automatically? that means once the email in the sent items folder appears , the to auto detect it from the subject and then delete it or move it to another mailbox . Does it do that?
0
 

Author Comment

by:WINBRO
ID: 36542705
Also sorry for the double post i need not to delete or move a folder but specific items in the folder of the sent items folder
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 36542723
You won't be able to have the email deleted instantly. The only way to do that would be to write an Exchange event sink, which would require programming knowledge on how to do so.

You could setup a powershell script to run the export-mailbox command in a continuous loop but depending on how many mailboxes you have, it could take minutes to complete each loop.

JJ
0
 

Author Comment

by:WINBRO
ID: 36542744
So the only way to do this is with a powershall or event sink. this could also slow down the system, right? i think its not the best option.
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 36542948
I'm not aware of any other way to do what you want. Running the powershell script should have minimal impact of the performance of the Exchange server.

JJ
0
 

Author Comment

by:WINBRO
ID: 36542959
i will have to find a way to right the powershell and put it in exchange because i am not really good at scripting.

Thank you.
0
 

Author Comment

by:WINBRO
ID: 36547508
if any guidence can be shown to me it will be a good help. Thank you
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 36548611
First, you ned to determine what to search for. Does the message have the same subject each time? Is there any other unique characteristic about the message that is common to each one? Do you want any instance of the message deleted or just deleted from certain users?

JJ
0
 

Author Comment

by:WINBRO
ID: 36548755
The subject of the email is unique except of the end that has a number.so its partly unique.

the email itself in the body contains the same thing with four words changing for crendential informations.


I want to delete all the messages with a specific type of subject that contains e.g. FFGGLL to be deleted from certain users of the company.


Thank you . If more information is needed i will be happy to provide you with...
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 36548777
It would be easier to write a script that would delete any email with the subject from any mailbox. So, to confirm, there are mailboxes you do not want this email removed from?

JJ
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 36548817
Why not just have another mailbox that these go from instead of the users mailbox?
0
 

Author Comment

by:WINBRO
ID: 36548839
No i was confusing . I want this email that is in the sent items folder to be deleted from everybody. It just only a number of users get this in their sent items folder.

we have created another mailbox for this thing but because the user sends it through another program as a user it is caught by outlook but we manage to change the from field to be directed to another mailbox so the client doesnt see it is coming from a user but from a department. The problem is that we dont want the user to have this in his sent items as it is shown
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 36548981
How does it get into the USERS sent items folder? This extenal app uses the users local outlook profile to send on behalf of another user?
0
 
LVL 37

Accepted Solution

by:
Jamie McKillop earned 500 total points
ID: 36548997
Assuming the email you want to delete have the string "String to delete" in the subject, you would run the following powershell command:

Get-Mailbox -ResultSize unlimited | Export-Mailbox -SubjectKeywords "String to delete" -DeleteContent

This will delete all email in all mailboxes that has "String to delete" in the subject. Change "String to delete" to whatever you want.

To get this to run continuously, open notepad and copy the following lines:

$i=1
While ($i=1) {
Get-Mailbox -ResultSize unlimited | Export-Mailbox -SubjectKeywords "String to delete" -DeleteContent
}

Save this as DeleteContent.ps1 on the system you are going to run it on.

Open notepad again and copy the following:

powershell -command "& 'c:\DeleteContent.ps1' "

Save this as DeleteContent.bat on the system you are going to run the script on. Change the path to the location where you saved the ps1 file.

On the system you are going to run this on, open the powershell console and type: set-executionpolicy unrestricted

Run the batch file. You can add it to the startup folder on the server so that it runs each times the server is rebooted.


JJ
0
 

Author Comment

by:WINBRO
ID: 36549007
we are using MS Dynamics CRM 2011 to send auto emails to the clients. The CRM is user based and it connects with Outlook to sent the emails. The email goes ok and managed to change the from field that the client gets with  another email by creating a rule on the exchange server for outgoing emails  from the organization to the clients. But the emails that are sent stay in the Sent Items folder. So that is why i want to find a way to delete the emails from the sent items folder with a specific word in the subject automatically. That means to auto detect the emails after the email is sent and then delete it permantly and not to  have it in the sent items folder in outlook.
0
 

Author Comment

by:WINBRO
ID: 36549042
Hi JJ ,

Does this command delete the email before it is sent to the client or it deletes it after it is sent in the sent items folder?
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 36549054
It will delete it after it is sent.

JJ
0
 

Author Comment

by:WINBRO
ID: 36549099
Ok i will try it and let you know. It may take until monday to give you an answwer because the IT is out of the office and he is in charge of the exchange server to put the script in there.

Thank you. I keep you posted.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now