次のエージェントは、所有権とユーザー情報 (どのユーザーの代わりにエージェントが実行するかなど) を含むメールを送信します。
Sub Initialize
Dim session As New NotesSession
Dim agent As NotesAgent
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim body As NotesRichTextItem
Set agent = session.CurrentAgent
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db )
doc.Form = "Memo"
doc.SendTo = session.EffectiveUserName
doc.Subject = "Owner, user, effective user, on behalf of"
Set body = New NotesRichTextItem(doc, "Body")
Call body.AppendText("Owner = " & agent.Owner)
Call body.AddNewLine(1)
Call body.AppendText("User = " & session.UserName)
Call body.AddNewLine(1)
Call body.AppendText("Effective user = " & _
session.EffectiveUserName)
Call body.AddNewLine(1)
Call body.AppendText("OnBehalfOf = " & agent.OnBehalfOf)
Call doc.Send( False )
End Sub