Wednesday, December 23, 2009

Sending Rich Text Notifications

'********************************************************************
'@Author : Karthikeyan A
'@Purpose : send rich text notification
'@Type : Function
'@Name : SendRichTextNotification
'@Return : Boolean (has operation succeded, True stands for success and False stands for failure)
'********************************************************************

Function SendRichTextNotification(recips As Variant, Subject As String, rtBody As NotesRichtextItem) As Boolean

'mark the flow of control getting inside the current function
SendRichTextNotification=False

'declare objects and variables required for further manipulation
Dim session As NotesSession
Dim doc As NotesDocument
Dim mailbody As NotesRichTextItem


'set the handle for the current session
Set session=New NotesSession

'create a mail document which is to be mailed
Set doc = session.CurrentDatabase.CreateDocument

'define its attributes
doc.Form = "Memo"
doc.Subject = Subject
doc.SendTo = recips

'define its body
Set mailBody = New NotesRichTextItem(doc, "Body")
Call mailBody.AppendRTItem(rtBody)

'send the mail
Call doc.Send(False)

'mark the flow of control moving out of the current function
SendRichTextNotification=True

End Function

No comments:

Post a Comment