Lotus Notes FAQ Visit Our Sponsor!

Can Domino prevent MS viruses from getting into user's mailboxes?

"Pre-Delivery Agents" were added to Domino R5. This lets you run an agent before a mail message is deposited into a user's mailbox. You can use this new feature in R5's mail template (mail50.ntf) to strip out all .vbs and .shs attachments from users' incoming mail. Create an agent named "Remove MS Viruses" in the R5 mail template. Set the agent to run "Before New Mail Arrives". Sign this agent with an ID that can run restricted agents on the server. Put this code in the agent's Initialize event:

Sub Initialize
  Dim session As New NotesSession
  Dim doc As NotesDocument
  Dim rtitem As Variant
  Dim p1 As Integer
  Dim p2 As Integer
  Dim filename As String

  Set doc = session.DocumentContext
  Set rtitem = doc.GetFirstItem("Body")
  If (rtitem.Type = RICHTEXT) Then
    If (Isarray(rtitem.EmbeddedObjects)) Then
      Forall obj In rtitem.EmbeddedObjects
        If (obj.Type = EMBED_ATTACHMENT) Then
          filename = Lcase(obj.Source)
          p1 = Instr(1, filename, ".vbs", 5)
          p2 = Instr(1, filename, ".shs", 5)
          If ((p1 > 0) Or (p2 > 0)) Then
            Call obj.Remove
            Call doc.Save(True, True)
          End If
        End If
      End Forall
    End If
  End If
End Sub

The most common Win32 extension types to worry about are (there may be others):
*.com, *.exe, *.bat, *.vbs, *.vbe, *.js, *.jse, *.hta, *.wsf, *.wsh, *.shs, *.scr, *.pif, *.xml, *.lnk, *.eml


In R6+, you can define server rules to remove messages that have certain extensions.


Applies to Notes Versions: 5
Last Modified: May 6, 2005