Home > Domino Tips > Spam and Security > Creating the "Mark unsigned mail with attachment" agent
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

SPAM AND SECURITY

Creating the "Mark unsigned mail with attachment" agent


Andreas Arning
09.10.2004
Rating: -4.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


First published on IBM developerWorks.

The "Mark unsigned mail with attachment" agent automatically checks for unsigned mail carrying an attachment. Because more and more mail messages are sent using an unknown or even a fake user ID, this agent can add one more level of security to help your organization prevent the spreading of worms and viruses.

In your Inbox, mail messages that have one or more attachments but don't have a digital signature will look like the fourth mail message (from the top) in the following screen. (Notice the bomb icon instead of the paper clip.)

Figure 1. Mail message with attachment marked as unsigned
Figure 1

Note: The bomb icon in the Subject column does not necessarily indicate a virus; it only indicates that the mail message contains an attachment, but has no digital signature. The other messages shown in the previous screen may or may not be signed. The "Mark unsigned mail with attachment" agent runs only on those messages that contain attachments. You can modify this agent to run on all mail messages if you prefer.

Creating the "Mark unsigned mail with attachment" agent

  1. Open a server replica or copy of a mail database.
  2. In Notes 5, choose Create - Agent. In Notes 6 or later, choose Create - Design - Agent.
  3. In the Agent Properties box, enter a name for the agent. We use "Mark unsigned mail with attachment."
  4. In Notes 5, select the Shared Agent option. In Notes 6 or later, select the Shared option.
  5. In Notes 5, in the "When should this agent run" field, select Before New Mail Arrives. In Notes 6 or later, select the same option from the Runtime drop-down list.
  6. In the Run drop-down list of the programmer's pane, select LotusScript.
  7. In the Objects pane, click Initialize, then delete the default lines: Sub Initialize ... End Sub.
  8. Add the following code to the agent:
    Sub Initialize
            Dim icon As Integer
            icon = 91
            Dim session As New NotesSession
            Dim doc As NotesDocument
            Dim it  As NotesItem
            Set doc = session.documentcontext
            If doc.HasEmbedded Then
                    If  Not doc.IsSigned Then
                            Set it = doc.GetFirstItem
    ("$ContentIcon")
                            Call doc.ReplaceItemValue
    ("$ContentIcon", icon)
                            Call doc.Save(True, False)
                    End If   
            End If
    End Sub
    
  9. Save and close the agent.

If you have the Mark incoming mail agent...

If you have already installed an agent for distinguishing incoming mail by To: and cc: (see the tip, Mark incoming mail for more information), add the following code rather than the code shown in the previous section:

Sub Initialize
        Dim icon As Integer
        icon = 91
        Dim session As New NotesSession
        Dim doc As NotesDocument
        Dim it  As NotesItem
        Set doc = session.documentcontext
        If doc.HasEmbedded Then
                If  Not doc.IsSigned Then
                        Set it = doc.GetFirstItem
("$ContentIcon")
                        Call doc.ReplaceItemValue
("$ContentIcon", icon)
                        Call doc.Save(True, False)
                End If   
        End If
        Const macro$ = "TO1:=3;TO2:=4;
CC1:=22;CC2:=21;BCC:=163;
DISTR:=70;" +_
        "userName:=@ProperCase
(@DbTitle);tmpvar:=@If(_ViewIcon!=""""&" +_
        "_ViewIcon!=0;0;@IsDocTruncated;0;
@ProperCase(@Name
        ([CN];SendTo))=userName;" +_
        "@If(@Elements(SendTo)=1;TO1;TO2);
@ProperCase(@Name
        ([CN];CopyTo))=userName;" +_
        "@If(@Elements(CopyTo)=1;CC1;CC2);
BlindCopyTo!="""";BCC;SendTo!
        ="""";DISTR;0);" +_
        "@Return(tmpvar)"
        Dim result As Variant
        result = Evaluate( macro$, doc)
        If Not result(0) = 0 Then
                Set it = doc.GetFirstItem("_ViewIcon")
                Call doc.ReplaceItemValue
("_ViewIcon", result(0))
                Call doc.Save(True, False)
        End If 
End Sub

Customization

If you prefer another icon to the bomb, use a number other than 91 in the second line of the preceding code:

icon = 91

For example, if you use 92 instead, you will get a stop sign icon as shown in figure 2. See the topic, "Displaying an icon in a column" in the Domino Designer help for a list of column icons that you can use.

Figure 2. Stop sign icon
Figure 2

For more information about Notes mail, see the following:

Do you have comments on this tip? Let us know.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Spam and Security
Securely connect Lotus Domino servers on different domains
Protect Lotus Notes from malicious code with the Domino ECL
How to correct Lotus Notes public key mismatches in four easy steps
A recipe for secure IM success
Telecommuter security kit
Spear phishing: Don't be a target
FAQ: Lotus Notes Domino password issues
Security awareness training: How to educate employees about spyware
Seven tips to strengthen your Domino e-mail security
Admin2005 preview: Tips, techniques, and a look at Notes/Domino Rel. 7

Development Security for Lotus Notes Domino
Top 10 Lotus Notes/Domino coding and development tips of 2008
Lotus Notes access error: 'database is not opened yet'
Top 10 Lotus Notes Domino programming and development tips of 2007
Verify Lotus Notes user access to Web pages
A bevy of Notes/Domino development tips
How to protect your Lotus Notes application design
A smorgasbord of Notes/Domino development tips
Ajax threats worry researchers
New chapter and verse on Ajax security
Java developers can't afford to ignore app security

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts