Send An Email Button With Lotusscript

I wanted to be able to send an email message using LotusScript that contained a
button for the recipient, without attaching a form to the message. This can be
used to send a button to perform some task on the users workstation i.e. add a
task to the users calendar, open a database or in the following example to
display a prompt box.

First I created a form called Prompt Button, that just has a Hotspot button on
it with the formula:
@Prompt([OK];"Seasons Greetings";"Happy New Year " + @Name([CN];@UserName));

Next, I created a LotusScript button (this could have been an agent) to send
out an email message containing this button using the following code:
Sub Click(Source As Button)

Dim s As New NotesSession
Dim db As NotesDatabase
Dim memo As NotesDocument
Dim body As NotesRichTextItem
Dim tempbuttondoc As NotesDocument
Dim temprtfield As NotesRichTextItem

Set db = s.CurrentDatabase
' Create a memo and set the fields
Set memo = db.CreateDocument
With memo
.Form = "Memo"
.SendTo = "Notes Team" 'The name of the person or group that you want
to send the message to
.Subject = "Email with button"
End With
Set body = New NotesRichTextItem( memo, "Body")
Call body.AppendText("Click on the following button.")
Call body.AddNewLine( 1 )

' Create a temporary document with the form that has the button
Set tempbuttondoc = db.CreateDocument
tempbuttondoc.Form = "Prompt Button"

' Add the button to a temporary field on the memo
Set temprtfield = New NotesRichTextItem( memo, "temprtfield")
success = tempbuttondoc.RenderToRTItem( temprtfield )

' Add (append) the button to body field of the memo
Call body.AppendRTItem( temprtfield )

' Remove the temporary field from the memo and send it
Call temprtfield.Remove
Call memo.Send(False)

End Sub

This was first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.