Home > Domino Tips > Developer > LotusScript > Fancy up Lotus Notes email with this enhanced SendMail function
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Fancy up Lotus Notes email with this enhanced SendMail function


Mohammed Misbahuddin
05.02.2006
Rating: -2.90- (out of 5)


Lotus Notes and Domino tips, tutorials and how-to articles
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


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.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
LotusScript
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication
LotusScript filters and attaches files to a Notes form

LotusScript
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
Run or restart Notes/Domino agents via text messages
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts