?
Solved

Lotus Domino/Notes Mail Agent

Posted on 2007-04-03
4
Medium Priority
?
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 750 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

765 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