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.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
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
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
- Open a server replica or copy of a mail database.
- In Notes 5, choose Create - Agent. In Notes 6 or later, choose Create - Design - Agent.
- In the Agent Properties box, enter a name for the agent. We use "Mark unsigned mail with attachment."
- In Notes 5, select the Shared Agent option. In Notes 6 or later, select the Shared option.
- 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.
- In the Run drop-down list of the programmer's pane, select LotusScript.
- In the Objects pane, click Initialize, then delete the default lines: Sub Initialize ... End Sub.
- 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
- 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 SubCustomization
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
For more information about Notes mail, see the following:
- Issue a warning about sending unsigned messages with attachments
- Marking incoming mail
- Creating an Inbox assistant
Do you have comments on this tip? Let us know.