Solved

Lotus Domino/Notes Mail Agent

Posted on 2007-04-03
4
361 Views
Last Modified: 2013-12-18
I need an agent that will run in a MailIn dB and delete any message that does not contain an .xls file. If that is not possilbe an agent that would delete any message that does not contain an attachment might suffice.
Running Domino and Notes 7.0.2

Thanks
0
Comment
Question by:HVBIT
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 250 total points
ID: 18842860
Sure, no problem.  Place this code in the Initialize event of a LotusScript agent that is set to run after new mail has arrived.

      Dim sess As New NotesSession()
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim docNext As NotesDocument
      Dim arrFileNames As Variant
      Dim strExtension As String
      Dim bDelete As Boolean
      
      Set db = sess.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      If (dc.Count = 0) Then Exit Sub
      
      Set doc = dc.GetFirstDocument()
      Do While (Not doc Is Nothing)
            
            Set docNext = dc.GetNextDocument(doc)
            
            bDelete = True
            arrFileNames = Evaluate("@AttachmentNames", doc)
            If (Not Isempty(arrFileNames)) Then
                  Forall fileName In arrFileNames
                        If (Instr(fileName, ".") <> 0) Then
                              strExtension = Strrightback(fileName, ".")
                              If (Lcase(strExtension) = "xls") Then
                                    bDelete = False
                                    Exit Forall
                              End If
                        End If
                  End Forall
            End If
            If (bDelete) Then Call doc.Remove(True)
            
            Set doc = docNext
      Loop
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 18843026
Wouldn't the same be possible with a mail rule?
0
 

Author Comment

by:HVBIT
ID: 18843145
Can't use Mail Rule, nothing to specify attachment.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 18843679
Is that so? Yes, most likely, I must say I didn't check. I'd expected an @AttachmentNames function to be absolutely valid in that context.

Thanks for posting back!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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