Q
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

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close