Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

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

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
WINBRO
Asked:
WINBRO
  • 11
  • 7
  • 3
1 Solution
 
Neil RussellTechnical Development LeadCommented:
Sounds like you got something to hide and would be a bad thing to do to me.
0
 
WINBROAuthor Commented:
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
 
Jamie McKillopCommented:
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
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
WINBROAuthor Commented:
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
 
WINBROAuthor Commented:
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
 
Jamie McKillopCommented:
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
 
WINBROAuthor Commented:
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
 
Jamie McKillopCommented:
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
 
WINBROAuthor Commented:
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
 
WINBROAuthor Commented:
if any guidence can be shown to me it will be a good help. Thank you
0
 
Jamie McKillopCommented:
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
 
WINBROAuthor Commented:
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
 
Jamie McKillopCommented:
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
 
Neil RussellTechnical Development LeadCommented:
Why not just have another mailbox that these go from instead of the users mailbox?
0
 
WINBROAuthor Commented:
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
 
Neil RussellTechnical Development LeadCommented:
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
 
Jamie McKillopCommented:
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
 
WINBROAuthor Commented:
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
 
WINBROAuthor Commented:
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
 
Jamie McKillopCommented:
It will delete it after it is sent.

JJ
0
 
WINBROAuthor Commented:
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

  • 11
  • 7
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now