This is an enhanced SendMail function for sending Notes/Domino document links with some extra features. In some instances, you might want to change the font or alignment of the body text; or if you want to make a Lotus Notes e-mail a bit fancier, this SendMail function will do it for you. It uses the bookmark form instead of the memo form. It's provided in the mailbox, specifically for workflow.
Function fnSendMailMemoEx(vSendTo As Variant,
vCcTo As Variant, vBccTo As Variant, szSubject As String,
szBody As String, nBodyTextFont As Integer,
nBodyTextFontSize As Integer, bBodyTextFontBold As Boolean,
nBodyTextAlign As Integer, docLink As NotesDocument) As Integer
'Legal Values for nBodyTextFont are
'FONT_ROMAN (0),
'FONT_HELV (1),
'FONT_COURIER (4),
'STYLE_NO_CHANGE (255)
'Legal Values for nBodyTextAlign are
'ALIGN_LEFT (0),
'ALIGN_RIGHT (1),
'ALIGN_FULL (2),
'ALIGN_CENTER (3),
'ALIGN_NOWRAP (4)
On Error Goto ErrorHandler
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim mailDb As NotesDatabase
Dim mailDoc As NotesDocument
Dim rtItem As NotesRichTextItem
Dim richStyle As NotesRichTextStyle
Dim rtpParagraphStyle As NotesrichTextParagraphStyle
Set mailDb =s.CurrentDatabase
Set mailDoc = mailDb.CreateDocument
mailDoc.Form = "BookMark"
mailDoc.SendTo = vSendTo
mailDoc.CopyTo= vCcTo
mailDoc.BlindCopyTo= vBccTo
mailDoc.Subject = szSubject
Set rtItem = mailDoc.CreateRichTextItem("Body")
Set rtpParagraphStyle = s.CreateRichTextParagraphStyle
rtpParagraphStyle.Alignment = nBodyTextAlign
Call rtitem.AppendParagraphStyle(rtpParagraphStyle)
Set richStyle = s.CreateRichTextStyle
richStyle.NotesFont = nBodyTextFont
richStyle.FontSize = nBodyTextFontSize
richStyle.Bold = bBodyTextFontBold
Call rtitem.AppendStyle(richStyle)
Call rtItem.AppendText(szBody)
If Not(docLink Is Nothing) Then
Call rtItem.AddNewLine(2)
Call rtItem.AppendDocLink
(docLink, "Double-click to open document")
End If
Call mailDoc.Send(False)
fnSendMailMemoEx = True
Exit Function
ErrorHandler:
Msgbox "SendMail: Error " & Str$(Err) & "
: " & Error$ & " : at line number " & Erl
Resume TheEnd
TheEnd:
fnSendMailMemoEx = False
End Function
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Mohammed Misbahuddin. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.