Home > Domino Tips > Administrator > E-mail > Delete DEAD mail
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

E-MAIL

Delete DEAD mail


Pablo Herman
09.09.2002
Rating: -3.75- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Ever try putting a scheduled agent in the mail.box database to remove dead mail? It works for a day and then stops working because the scheduler does not recognize it due to the fact that it is an internal database. Because this doesn't work I created an agent to run from a normal database on the server.

This agent will loop through the mail boxes on the server and remove dead mail based on a specified selection formula. I built this selection formula by first creating a view in the mail.box database and putting in the specified formula. Once satisfied I moved this formula into my script code to use as a search string. You can schedule this agent as often as you would like and it should automatically keep your mail boxes clean. You will need to put it in a normal(.nsf) database and not the mail.box database otherwise the scheduler will not recognize it.



Code

Option Public

Sub Initialize '=============================================================================================== 'Created by Pablo Herman(1stopdomino) on 8-27-2002 '=============================================================================================== 'This agent will loop through the mail boxes on the server and remove dead mail based on a 'specified selection formula I built this selection formula by first creating a view in the 'mail.box database and putting in the specified formula. Once satisfied I moved this formula 'into my script code to use as a search string. You can schedule this agent to run as often 'as you would like and it should automatically keep your mail boxes clean. You will need to 'put it in a normal(.nsf) database and not the mail.box database otherwise the scheduler will 'not recognize it. '===============================================================================================

 Dim s As New NotesSession
 Dim mbox As NotesDatabase
 Dim dc As NotesDocumentCollection
 
 '>>Establish the database list to process
 Redim dbarray(2) As String
 dbarray(0) = "mail1.box"
 dbarray(1) = "mail2.box"
 dbarray(2) = "mail3.box"
 
 '>>If you only have one mail.box then remark the above 4 lines and unremark the next 2 lines
 'Redim dbarray(0) As String
 'dbarray(0) = "mail.box"
 
 '>>Define search fomula
 sstring$ = "SELECT FORM = ""NonDelivery Report"" & @Contains(@UpperCase(FailureReason); " & _
 """USER ACCOUNT INACTIVE"" : ""NO SUCH USER"" : ""NOT LISTED IN PUBLIC"")"    
 '>>Loop through all databases and remove documents based on the search formula
 Forall d In dbarray
  '>>This can only run on the same server it is scheduled on therefore use we can only use ""
  Set mbox = s.GetDatabase("", Cstr(d))
  If mbox.isopen Then
   Set dc = mbox.Search(sstring$, Nothing, 0)
   Print "Found " & dc.count & " documents to delete in " & mbox.filename
   Call dc.RemoveAll(True)
  Else
          Print "Unable to open database " & Cstr(d)
  End If
 End Forall
 
End Sub

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
E-mail
Secure Lotus Notes/Domino 8.x from mail to unknown recipients
Domino server setting and email policy tricks admins must know
Top 10 Lotus Notes/Domino administration tips of 2008
Can Lotus Notes/Domino and Microsoft SharePoint play nice together?
Using Formula language code to sort Lotus Notes messages by subject
LotusScript action button manages Lotus Notes mail files
Exploring Lotus Notes Domino 8.0.1 and beyond
LotusScript agent moves tagged spam email to junk mail folder
Send SMS text messages between Lotus Notes 7 and mobile devices
Update to Exchange Server 2003 Connector for Lotus Notes

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts