Send email notification with LotusScript
September 16th, 2009 by bfebrianLotus Notes and Domino is not only about email, it’s more than that. One of it’s feature it workflow, where people can create workflow application faster an d easier than any other application out there.
One of the important thing in workflow is email notification, to let users know that they have one job to do, or just simply notification.
Example, if a staff create a leave request and when he or she submit the request, his or her manager will get an email notification about the request.
I have this one of my favorite sub program to create an email notification, well I named it “CreateEmailNotification”
.
If you like, you can use it for free. Just copy the sub program in one or new Script Library.
This is the sub program.
=====Start of Sub Program
Sub CreateMailNotification(doc As notesdocument, strSendTo As Variant, strSubject As String, strCopyTo As Variant)
Dim session As notessession
Dim db As notesdatabase
Dim docMail As notesdocument
Dim rtitem As Variant
Set db = doc.parentdatabase
Set session = db.Parent
Set docMail=db.createdocument
Set rtitem=docMail.CreateRichTextItem(“Body”)
If strSendTo(0)=”" Then Exit Sub
‘=====set mail
docMail.Form = “Memo”
docMail.From = session.UserName
docMail.Principle = session.UserName
docMail.SendTo = strSendTo
If Isarray(strCopyTo) Then
If strCopyTo(0)<>”" Then
docMail.CopyTo = strCopyTo
End If
Else
If strCopyTo<>”" Then
docMail.CopyTo = strCopyTo
End If
End If
docMail.Recipients = strSendTo
docMail.Subject = strSubject
docMail.PostedDate = Now
‘=====set body field
Call rtitem.AppendText(“Please click this doclink to see more details about the status ” + ” “)
Call rtitem.AppendDocLink( doc, “click to open document”)
Call rtitem.AddNewLine( 2 )
‘=====send mail
Call docMail.send(False)
End Sub
=====End of Sub Program
Feel free to do some modification if necessary.
You can call it from any lotusscript with simple line like this.
call Call CreateMailNotification (doc, doc.nmSendTo, strSubject,doc.nmCopyTo)
Don’t forget to put use “Script Libary Name” first.
Popularity: 5% [?]
Tags: email-notification, lotus-domino, lotus-notes, lotus-script, workflowSave to del.icio.us | Stumble It! | Submit to Netscape | Digg This!
Related Posts:
Posted in Lotus Notes and Domino, Programming | 1 Comment »


July 21st, 2010 at 4:48 pm
We use the Ionet Workflow Manager for developing our Workflow applications. With this engine workflows can be created very easy, no programmeing experience needed.