Home > Domino Tips > Administrator > Mail > Delete mail containing certain attachment types and store in global mail file
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

MAIL

Delete mail containing certain attachment types and store in global mail file


Mohammed Naseer
06.25.2002
Rating: --- (out of 5)


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


This script should be run by agent and it should be scheduled (before new mail). This agent should reside in the user's mail file. It checks for certain type attachments in the mail and deletes from the user's mail file and copied to global mail file. Create a user as global user to use his mail file as global mail file.

Code

On Error Goto ErrRt 
Dim Session As New notessession
Dim DB As notesdatabase 
Dim Doc As notesdocument
Dim AttachItem As notesembeddedobject
Dim  FindStr As Variant
Dim AttachSource As String
Dim FileName As Variant
Dim Body, TempSendTo As Variant
Dim emphasize As NotesRichTextStyle

Set emphasize = Session.CreateRichTextStyle
emphasize.Bold = True
emphasize.NotesColor = COLOR_RED
 
Set DB = Session.currentdatabase
Set Doc = Session.documentcontext 
Set FindStr = Doc.getfirstitem("body") 
Forall Att In Doc.items
If (Att.Type = ATTACHMENT) Then
Set Attachitem = Doc.GetAttachment(Att.Values(0))
FileName = Lcase(Attachitem.source)
 
'* Checking for File Types.   
If Right(FileName,3) = "vbs" Or Right(FileName,3) = "vbe" Or Right(FileName,3) = "pif" Or Right(FileName,3) = "jpg" Or Right(FileName,3) = "bmp" Or Right(FileName,3) = "scr" Or Right(FileName,3) = "exe" Or Right(FileName,3) = "avi" Or Right(FileName,3) = "mpg" Or Right(FileName,3) = "mpeg" Or Right(FileName,3) = "mp3" Then
    
'** To Copy document with Attachment into BackUp mail file        
TempSendto = Doc.getitemvalue("SendTo")
doc.SendTo = "Tmail"
doc.Subject = "Copy of mail with Attachment  : " & FileName

Call doc.Send( False )
doc.SendTo = TempSendTo(0)
'** Removing Attachment from Master Document
    
Call Attachitem.remove       
Set Body = Doc.getfirstitem("body")
Call Body.AddNewLine(1)
Call Body.AddNewLine(1)
Call Body.AppendStyle(emphasize)
Call Body.AppendText("Warning :")
Call Body.AddNewLine(1)
Call Body.AppendText("The following file has been deleted out of this email by a virus checking procedure : " & filename &".")
Call Body.AddNewLine(1)
Call Body.AddNewLine(1)
Call Body.AppendText("Please contact Notes Administrator.")     
End If     
End If  
End Forall
ErrRt:
Print "Error " & Erl & ": " & Error$
Exit 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
Mail
Run or restart Notes/Domino agents via text messages
How to create mail files using a LotusScript agent
How to turn off the message recall feature in Lotus Notes 8
Domino server setting and email policy tricks admins must know
Top 10 Lotus Notes/Domino administration tips of 2008
Understanding a Lotus Notes Smart Upgrade rollout
Bringing MailRule documents back into view
Use SMTP outbound authentication to relay hosts in Lotus Notes Domino 8
Notes/Domino 6 version of 'Discover Folder'
Five tips to improve email performance

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