Solved

Lotus Domino/Notes Mail Agent

Posted on 2007-04-03
4
352 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A short film showing how OnPage and Connectwise integration works.

948 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

21 Experts available now in Live!

Get 1:1 Help Now