Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 155403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:08:58+00:00 2026-05-11T10:08:58+00:00

I have little Lotus Script or Notes/Domino knowledge but I have a procedure, copied

  • 0

I have little Lotus Script or Notes/Domino knowledge but I have a procedure, copied from somewhere a long time ago, that allows me to email through Notes from VBA. I normally only use this for internal notifications where the formatting hasn’t really mattered.

I now want to use this to send external emails to a client, and corporate types would rather the email complied with our style guide (a sans-serif typeface basically).

I was about to tell them that the code only works with plain text, but then I noticed that the routine does reference some sort of CREATERICHTEXTITEM object. Does this mean I could apply some sort of formatting to the body text string after it has been passed to the mail routine? As well as upholding our precious brand values, this would be quite handy to me for highlighting certain passages in the email.

I’ve had a dig about the ‘net to see if this code could be adapted, but being unfamiliar with Notes’ object model, and the fact that online Notes resources seem to mirror the application’s own obtuseness, meant I didn’t get very far.

The code:

Sub sendEmail(EmailSubject As String, EMailSendTo As String, EMailBody As String, MailServer as String)      Dim objNotesSession As Object     Dim objNotesMailFile As Object     Dim objNotesDocument As Object     Dim objNotesField As Object     Dim sendmail As Boolean      'added for integration into reporting tool     Dim dbString As String      dbString = 'mail\' & Application.UserName & '.nsf'  On Error GoTo SendMailError     'Establish Connection to Notes     Set objNotesSession = CreateObject('Notes.NotesSession') On Error Resume Next     'Establish Connection to Mail File     Set objNotesMailFile = objNotesSession.GETDATABASE(MailServer, dbString)     'Open Mail     objNotesMailFile.OPENMAIL On Error GoTo 0      'Create New Memo     Set objNotesDocument = objNotesMailFile.createdocument      Dim oWorkSpace As Object, oUIdoc As Object     Set oWorkSpace = CreateObject('Notes.NotesUIWorkspace')     Set oUIdoc = oWorkSpace.CurrentDocument      'Create 'Subject Field'     Set objNotesField = objNotesDocument.APPENDITEMVALUE('Subject', EmailSubject)      'Create 'Send To' Field     Set objNotesField = objNotesDocument.APPENDITEMVALUE('SendTo', EMailSendTo)      'Create 'Copy To' Field     Set objNotesField = objNotesDocument.APPENDITEMVALUE('CopyTo', EMailCCTo)      'Create 'Blind Copy To' Field     Set objNotesField = objNotesDocument.APPENDITEMVALUE('BlindCopyTo', EMailBCCTo)      'Create 'Body' of memo     Set objNotesField = objNotesDocument.CREATERICHTEXTITEM('Body')      With objNotesField         .APPENDTEXT emailBody         .ADDNEWLINE 1     End With      'Send the e-mail      Call objNotesDocument.Save(True, False, False)     objNotesDocument.SaveMessageOnSend = True     'objNotesDocument.Save     objNotesDocument.Send (0)      'Release storage     Set objNotesSession = Nothing     Set objNotesMailFile = Nothing     Set objNotesDocument = Nothing     Set objNotesField = Nothing      'Set return code     sendmail = True      Exit Sub  SendMailError:     Dim Msg     Msg = 'Error # ' & Str(Err.Number) & ' was generated by ' _                 & Err.Source & Chr(13) & Err.Description     MsgBox Msg, , 'Error', Err.HelpFile, Err.HelpContext     sendmail = False End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:08:59+00:00Added an answer on May 11, 2026 at 10:08 am

    The short answer is Yes. The long answer is painful. There aren’t any great classes exposed to manipulate rich text items in Notes. However a few that you can research are the NotesRichTextStyle, NotesRichTextParagraphStyle, and NotesRichTextTable to name a few. These classes help you define some rich text elements and add them programmatically to your rich text field.

    Another approach, since you’re sending email, is to use the NotesMIMEEntity classes and build the email using HTML (way way easier). Here’s some sample code:

    Set s = New NotesSession Dim docMail As NotesDocument Dim body As NotesMIMEEntity Dim stream As NotesStream  Set db = s.CurrentDatabase s.ConvertMIME = False ' Do not convert MIME to rich text  'Create email to be sent Set docMail = db.CreateDocument  With docMail         .SendTo = SEND TO ADDRESS         .From = FROM ADDRESS         .Principal = FROM ADDRESS         .ReplyTo = REPLY TO ADDRESS         .Subject = SUBJECT         .Form = 'Memo' End With    Set stream = s.CreateStream Set body = docMail.CreateMIMEEntity Call stream.WriteText ('YOUR HTML CODE GOES HERE')  'ENC_IDENTITY_8BIT used because of technote found on notes.net 'http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/aeedaf28e47546ad85256f6a000a4b48?OpenDocument Call body.SetContentFromText (stream, 'text/html;charset=iso-8859-1',ENC_IDENTITY_8BIT)   Call docMail.Send(False) Set docMail = Nothing Set body = Nothing Set stream = Nothing  s.ConvertMIME = True ' Restore conversion    

    Essentially you’ll need to turn the ConvertMIME setting off in the NotesSession. Then create a new document, set the mail properties, etc. That part is already in your VBA code. Next, create the MIMEEntity and a stream to hold your HTML text. Finally call the SetContentFromText method on your MIMEEntity object. Then send your email. Note the last call is to turn the ConvertMIME feature back on for the NotesSession.

    I’m not sure if this will all work via COM, but it does work well in LotusScript agents in Notes.

    I hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little knowledge of Flash but for a little Flash game I have
I've been using python for years, but I have little experience with python web
Skip to bottom for question, but first, a little context. So I have been
In our infrastructure, we have lots of little Java projects built by Maven2. Each
i have little problem with boost::asio library. My app receive and process data asynchronously,
I need MatLab for 2D and 3D modeling. I have little experience in MatLab.
I have a little dilemma that maybe you can help me sort out. I've
I have a little game written in C#. It uses a database as back-end.
I have a little problem with a Listview. I can load it with listview
I have a little program that I want to make open automatically when my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.