Problem solve Get help with specific problems with your technologies, process and projects.

Agent cannot encrypt e-mail message

I have an agent which takes an inbound e-mail and forwards it. The forward recipient e-mail address is taken from the Subject field (the actual subject is left in the field). This works, but I cannot get the message to encrypt. This should work, since if I define the recipient in the script, it does. But when I'm parsing it out from the subject field, it won't encrypt. What am I missing?

Here's the agent script:

REM Recipient is split from Subject field. 
REM Agent is set to run before new mail. 
REM Agent security is set to 2. 
Sub Initialize 
            Dim session As NotesSession 
            Set session = New NotesSession 
            Dim db As notesdatabase 
            Dim Maildoc As notesdocument 
            Set db = session.CurrentDatabase 
            Dim doc As NotesDocument 
            Set doc = session.DocumentContext 
            Dim ret As Variant 
            Dim teststr As String 
            Dim delim As String 
            teststr = doc.Subject(0) 
            delim = "&" 
            ret = Split(teststr, delim) 
            Print ret(0) 
            Print ret(1) 
            Set Maildoc = New NotesDocument( db ) 
            Call doc.CopyAllItems( Maildoc, True )     
            Maildoc.From =  doc.From(0) 
            Maildoc.Form = "Memo"           
            Receipient = ret(0) 
            Maildoc.Subject           = ret(1) 
            Call Maildoc.Save( True, True ) 
            Maildoc.EncryptOnSend = True 
            Call Maildoc.Send (False, recipient) 
            Call Maildoc.RemovePermanently(True) 
End Sub 
Encryption must know who you're sending to and also must be able to find their public key (in the Person document in the address book). This can fail either because a) the recipient's Person information is not available in the context where the code is running, or b) because the name is not recognized sufficiently well to find the person record.

If the agent works with a hardcoded name and fails with a calculated name in the same context, reason b is more likely. If the calculated recipient name is an Internet address rather than a Notes username, for instance, the Send method probably can't match it up with a Notes username. In that case, you will probably need to program a function yourself to find the corresponding Person record and use it to translate the address into a fully qualified Notes username.

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on Lotus Notes Domino Email Encryption



  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...