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
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
Related Q&A from Andre Guirard
Learn how you can use LotusScript and OLE to create and populate Microsoft Excel spreadsheets, as well as a little bit about Lotus Symphony. Continue Reading
Discover options you can use if you'd like external users to be able to access a workflow-based Notes Domino application through different ... Continue Reading
Learn why you may receive the error message: "Illegal circular use: Audit Trail" when trying to open Lotus Notes documents that use copied forms. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.