Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Lotus Domino/Notes Mail Agent

Posted on 2007-04-03
4
Medium Priority
?
382 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

636 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