HTML Emails The Easy Way

Almost exactly five years ago I wrote a series of articles that described how to send emails in HTML format. At the time they were ground-breaking in that there was no other easy way to do it in Notes and I like to think my methods helped a lot of people achieve the goal of easily sending formatted emails.

Times change though and new methods are always coming to light. Recently I found a way of achieving the same goal using new Domino 6 LotusScript classes. There's now no need to use any tools other than those we already have. The approaches I discussed all that time ago are now defunct and no longer needed.

Not needing complicated additions to your applications is a godsend. Personally, I was always put off using my own mailing methods due to the awkwardness of their implementation.

The Old Approach

The first solution I came up with involved using a scheduled Java agent to send the mails. Emails would be queued in a special database. The agent would then loop through them every five minutes or so and send the queued mail. Java was used as it allowed us to open TCP sockets and directly send the mail to port 25 on any SMTP server, line by line.

Developing this approach required a knowledge of the SMTP protocol and how emails are constructed. Although we no longer need to know this I'd still recommend you read the first part of the series for some valuable background information on SMTP and the basics of how emails work.

Shortly after developing this solution somebody told me about a way to connect to sockets on servers using Win32 methods. This approach was similar but there was no need to use Java. Still it was far from perfect and even worse than being in Java it was Windows-only. The shame.

The New Approach

Domino 6 introduced a new method to the NotesMIMEEntity class called setContentFromText(). This allows us to add MIME entities to a message and add our own text content to it. Not only this but we can dictate the headers and content types of the message. This gives us the ability to send emails in multiple formats. We'll talk about why we might want to send in more than one format later. For now, let's·look at the·code you need to do this:

Dim body As NotesMIMEEntity
Dim mh As NotesMimeHeader
Dim mc As NotesMIMEEntity
Dim stream As NotesStream 
session.convertMIME = False
MailDoc.Form="Memo" MailDoc.SendTo="me@me.com" MailDoc.Subject="Test HTML Messages" 'Create the MIME headers Set body = MailDoc.CreateMIMEEntity Set mh = body.CreateHeader({MIME-Version}) Call mh.SetHeaderVal("1.0") Set mh = body.CreateHeader("Content-Type") Call mh.SetHeaderValAndParams( {multipart/alternative;boundary="=NextPart_="} ) 'Send the plain text part first Set mc = body.createChildEntity() Set stream = session.createStream() Call stream.WriteText("Hello. I'm boring.") Call mc.setContentFromText(stream, {text/plain}, ENC_NONE) 'Now send the HTML part. Order is important! Set mc = body.createChildEntity() Set stream = session.createStream() Call stream.WriteText("Hello. I'm <b>exciting</b>") Call mc.setContentFromText(stream, {text/html;charset="iso-8859-1"}, ENC_NONE) 'Close the stream Call stream.close() 'Send it Call MailDoc.Send(False)

Working through it bit by bit it should be obvious what's going on. If not, don't worry. In the demo download I've put the code in a sub routine in a Script Library called "CommonRoutines", so you don't need to worry about it too much. If you want to understand the code you can digest it at will.

Note: It's important to get the message parts in right order — HTML then plain text. Also, if you use Principal field overrides, that code has to come after the MIME streams in the code.

Let's look at how we can use this code:

Using the Code:

The way I've begun to use the code is pretty much as it is in the sample database. There's a script library called CommonRoutines, which I tend have in all my databases and which all Agents tend to include, much like all my Forms use the CommonFields subform.

In this library is the routine called sendMessage() which contains the code outlined above. Calling this method looks like this:

Call sendMessage("SendTo", "Subject", "<p>Hello</p>", "Hello")

The first two arguments are self-explanatory. The second two are the email body in HTML and plain format, respectively.

In most case the last two arguments will contain the same text, but the HTML part will be formatted with extra markup. Whereas the plain string might contain a splattering of Chr(10) the HTML string can make do with using <p> and/or <br> tags.

Here's a more typical real world demo:

Dim BodyHTML as String, BodyPlain as String, FullURL as String
'FullURL best controlled by config/app setting, rather than hardcoded!
FullURL = "http://myserver/myDb.nsf/"
BodyHTML = "<h1>A New Ticket Has Been Submitted</h1>"
BodyHTML = BodyHTML + "<p>Click the link below to open this ticket</p>"
BodyHTML = BodyHTML + |<p><a href="|+FullURL + |/tickets/| + doc.unid +|">| _
        + doc.Title(0) + |</a></p>|
BodyText = "A New Ticket Has Been Submitted" + Chr(10) + Chr(10)
BodyText = BodyText + "Click the link below to open this ticket" + Chr(10) + Chr(10)
BodyText = BodyText + doc.Title(0) + Chr(10)
BodyText = BodyText + FullURL + "/tickets/" + doc.unid
Call sendMessage(doc.Responsible, db.Title + ": New Ticket", BodyHTML, BodyText)

There's an obvious drawback to this — we need to create two strings with the same information in them. This adds up to twice (if not more) coding each time you want to compose a message. True, but, once you've read what's to follow I'll hope you'll agree it's worth the effort. Certainly I've used this duplicate approach to all automated messages I've created since discovering this.

Nothing's Ever Simple:

The ability to use HTML in an email should be an absolute godsend, both to developer and to user. Instead, what was a great idea, has become a bit of headache for all involved.

Why the need for multiple formats? Well, quite simply, not all mail clients support HTML emails. Not only that but some users — myself included — opt to display all received email in plain text format, which is a global config setting in the Thunderbird mail client. This is only possible if the mail has a plain text alternative part.

Here's an test email message being read in Thunderbird. First, in HTML format:

Now here's the same message after I've told Thunderbird to view it in plain text mode.

Notice the same content gets to the user, just with different styling. This isn't true of messages where you miss out the alternate part. Sure, most people probably will have the ability to read HTML emails but assuming this is a brave step for any developer.

Creating a Look and Feel

Notice how the HTML string in the demo code above started with a H1 and no HTML, BODY or HEAD tag. This doesn't mean you don't need the complete HTML structure for an email, as you do. It just means I've taken the whole HTML envelope structure needed to wrap the message and placed it in the SendMessage routine. This assumes all emails you send from that one database will have a common look and feel. For this reason I've shown how, in the SendMessage routine, you can add some CSS to the HEAD tag. You could go one step further, as I tend to do, and add a banner to the top of all outgoing messages - perhaps including the company logo and the database title. You can see this in effect in my blog entry about my "CRM".

Talking of logos...

Attaching Images

Although it's possible to embed images as attachments to email I'd advise against it and not only because it doesn't work in all clients. It's much easier to add an inline image to your HTML email which simply point to an image on a remote server. Saves space in the email as well. It's annoying getting bloaty emails form people where they've attached their company logo to the footer of every message.


Like it or not, HTML email are here to stay. Used in a considerate way they are a brilliant way to get information out to a system's users. Although I've never actually used the previous methods of sending them that I've talked about I'm now a big user of this approach. Having to code the content of emails twice is a pain, but it's worth it to feel safe in the knowledge the email works at a lowest common denominator level of email clients.

I know the last article I wrote about HTML emails was called Sending HTML emails, the final word, but I now believe this is the final word on sending HTML emails from Domino!

Further Reading


  1. Great article, thanks you!

    Nice to hear this topic discussed. I am sure there are lots of us out here doing this all different ways. I'd be interested to hear what tricks others are up to too.

    I've used this technique with a view of "settings" documents to let the owners of DBs create HTML email in richtext ("store content as html+mime") -- they create the layout template and can insert variables -- then get that mime entity and parse the text nodes for variables to replace when creating the email...

    My biggest problem with using the store as mime this way is every time the settings doc is saved Notes inserts an extra <br> tag at some random, inconsistent place in the beginning HTML of the mime entity... so the user occasionally needs to remove the extra line breaks...

    I agree with the caution about inline images but FWIW you can embed them using this method.... just put them in the RT field and use a recursive method to copy the child entities (preserving their headers)...


  2. Additional information

    Good article, I could have used this about a month ago too, as I have just been through some of the same motions.

    Being able to make HTML mails is unfortunately only half the job, as various mail clients can make quite a mess of rendering it.

    So in no particular order is a couple of hints from someone who has had to discover them the hard way:

    - No fancy div positioning - back to good old tables - Expect all content in head tag to be stripped - Expect all style tags to be stripped. - Expect attributes on body tag to be stripped - Expect all class attributes to be stripped - Don't use inline MIME encoded images - if you need images, use http links to a webserver - MIME encode all non-US ASCII characters and also equal (0x3D) - Don't expect images to be stretched correctly, especially with width=100% - Gmail (and others) use about 400px for menus and ads, so if you are designing for 1024x768, you only have about 600px visible before horizontal scrollbar. - If you can get your html mail to render correctly in Notes and Gmail, you are most likely home free - I also tested in Hotmail, Yahoo mail and Outlook, but the first two mentioned are the hardest to satisfy.

    I got a lot of these clues from http://www.sitepoint.com/article/code-html-email-newsletters and the links in the bottom of that article.


      • avatar
      • Jake Howlett
      • Tue 3 Apr 2007

      Re: Additional information

      Thanks Claus. Very useful additional information. I meant to add a bit about keeping the HTML as simple as possible, but forgot.


  3. Can you send attachments?

    We tried to use NotesMIMEEntity to send some "pretty" (well at least prettier than what Notes can do) emails with attachments. However, we had some problems including the attachments (they didn't send to users outside the Domino server) and finally gave up, as prettiness wasn't really that necessary for our app.

    It might have been our mistake, or a bug in an older version of Domino 7.0.x, but I'm curious as to wether you have managed to include attachments with those emails.

      • avatar
      • Jake Howlett
      • Thu 5 Apr 2007

      Re: Can you send attachments?

      Hi Salvador,

      I've not tried with attachments, but I did get inline images to "work". If file attachments were needed I'd bet tempted to agree prettiness can come second.


    1. Re: Can you send attachments?

      Hi Salvador,

      I've been using the NotesMIMEEntity class for a while now and have worked with attachments too. The files you want to send have to be (temporarily) on the server's file system to be able to read them into a MIMEEntity (I didn't find a way to read embedded objects to a stream directly).

      The following code should help you on the right track:

      dim strFileAttachments List As String

      strFileAttachments("image.gif") = "c:\somewhere_on_your_server\image.gif" strFileAttachments("word.doc") = "c:\somewhere_on_your_server\word.doc"

      'create mime attachments for every file Forall file In strFileAttachments 'set correct content types for known file types Select Case Lcase(Strright(file, ".") ) Case "gif" strContentType = "image/gif" Case "jpeg", "jpg" strContentType = "image/jpeg" Case Else strContentType = "application/octet-stream" End Select Set mimeChild = mimeRoot.CreateChildEntity Set header = mimeChild.CreateHeader("Content-Disposition") Call header.SetHeaderVal({attachment; filename="} & Listtag(file) & {"} ) 'only required if we're embedding something we need to reference later on, i.e. inline images 'Set header = mimeChild.CreateHeader("Content-ID") 'Call header.SetHeaderVal( |<| & Listtag(file) & |>| ) Set stream = session.CreateStream If stream.Open(file) Then Call mimeChild.SetContentFromBytes(stream, strContentType & {; name="} & Listtag(file) & {"}, ENC_IDENTITY_BINARY) Call stream.Close End If End Forall

      Show the rest of this thread

  4. Changing the from address

    This technique works fine if you want the from address of the email to be either the user or the agent signer. However sometimes you want to be able to control the from address programatically.

    For plain text emails this is quite easy - you just need to set a field called INetFrom with a value of the email address that you want to use. However the only way I could get this to work for html emails was to set fields called 'From' and 'SMTPOriginator' with the value required and replace the call to NotesDocument.Send with saving the document in the mail.box database on the server.

    If anyone knows of a better approach then please share...

    1. Re: Changing the from address

      Interesting question, - I am having the same issues... Anyone?

      Show the rest of this thread

    2. Solution !

      You just need to add some more header information to the email.

      ' controlling from and reply to Set mh = body.CreateHeader("From") Call mh.SetHeaderVal(sFrom) Set mh = body.CreateHeader("SMTPOriginator") Call mh.SetHeaderVal(sFrom) Set mh = body.CreateHeader("Sender") Call mh.SetHeaderVal(sFrom) Set mh = body.CreateHeader("INetFrom") Call mh.SetHeaderVal(sFrom) Set mh = body.CreateHeader("ReplyTo") Call mh.SetHeaderVal(sReply) Set mh = body.CreateHeader("DisplaySent") Call mh.SetHeaderVal(sFrom)

      I am passing some more arguments to the function, like "sReply" and "sFrom", but that's ofcourse an easy adjustment.

      Best regards, Rune Carlsen Dominozone.net

      Show the rest of this thread

  5. Mails sent recognized as spam

    Hi everyone, this is a great tip, we have been searching for a solution that sends notifications to users signed to an online application of one our customers, but all solutions tested including this one sends "correct" html-formated e-mails, but when we send them to @hotmail.com for example it gets directly to the spam folder, if we send the same html code, with the same subject, sender, etc.. with Outlook Express it enters directly to the inbox folder, ANY SUGGESTION PLEASE!!! thanks...

  6. Emails

    hi, the code is great, however i have a problem.

    How can we include a doclink to the email?

  7. Great Work. Thanks for sharing

    Thanks Jake,

    I was looking for exactly the samething. You already solved my problem.

    Great work (Y)

  8. Thanks and one comment

    Can't wait to use it!

    Noticed that there is probably a typo in the Note about ordering:

    Note: It's important to get the message parts in right order — HTML then plain text. Also, if you use Principal field overrides, that code has to come after the MIME streams in the code.

    I think you mean "plain text then HTML" since that's what you do in the code.

  9. Additional gotchas


    A few more things to add: 1) This (and some more) information is available in the sandbox at http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/5407d5b fd7b0f4ce85256cd2004de094?OpenDocument&Highlight=0,mime

    and here: http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/7479a9b ac473cf9185256a72006b8a19?OpenDocument&Highlight=0,mime

    2) If you're attaching an image you need to use BASE64 encoding to get it to show correctly.

    3) Some symbols won't show unless you specify content-type of your html as "text/html;charset=windows-1252"

    4) The notes client doesn't support background colours or images for html tables. It also does not support the &lt;link rel> tag.

    5) If a user uses the iNotes web client to open the email, it will strip out &lt;html>,<head>, <script&gt; and &lt;body> tags (and I think everything within them). This means that the only way to get css to work is to put it inline with the page content rather than in the &lt;head> tag.

    6) <BASE HREF&gt; tags work in the notes client when added to the head content. However in iNotes, whilst they change the base url of links in the email, they also change the base url of everything else too, so inline images don't work! This seems to be a bug with the iNotes client, and it appears from the support database that Lotus have no plans to address it.

    However, if you can see past these small annoyances, I'm sure you'll agree that this is a valuable addition to tools that can be used to send great looking email messages to users.



    1. Display Html file with image

      I have a problem. If I import an entire html page from local directory by using notesmimeentity, there will be some problem in javascript and image. I save the html file as *.mht format , but it can't be displayed correctly, the word document has the same problem. Does any one know how to display an entire htm | mht | word document with image in rtf field correctly?

      Set stream = s.CreateStream s.ConvertMIME = False Set doc = db.CreateDocument

      Set body = doc.CreateMIMEEntity Set header = body.CreateHeader("Subject") Call header.SetHeaderVal("HTML message") ' this is the subject

      Call stream.Open("C:\Test001.htm") Call body.SetContentFromText(stream,"text/html;charset=utf-8",ENC_IDENTITY_BINARY)

      s.ConvertMIME = True

  10. Images showing with an X

    Hello Jake

    I am running notes 8, - have you seen that images show up with the red X? If I press forward, in the client, suddenly the image is showing. You know why this is?


    1. Re: Images showing with an X

      New feature in Notes 8 :) Check out your preferences, or click "show images".... am I talking to myself here?

      Show the rest of this thread

  11. Java version

    Great article, however I needed this logic within a web application (to use Domino as a mail-server from within an iSeries application).

    As other people might be in the same situation I submit the translation to Java of the lotusscript code.

    The application makes a connection to the Domino server through DIIOP to get a global notes Session parameter. Then this is used in the sendhtmlmail method.

    If people need the full application, I can send the jar file through e-mail.

    /** * Connects to the Domino application server, and sends an email. * * * @param sendTo * @param copyTo * @param subject * @param message * @param htmlMessage */ public void sendHtmlMail(String sendTo, String copyTo, String subject, String message, String htmlMessage) { lotus.domino.Document memo = null; try { this.m_dominoSession.setConvertMime(false); // MIME gebruiken i.p.v. Rich Text memo = m_dominoMailDb.createDocument(); memo.appendItemValue("Form", "Memo"); // memo.appendItemValue("Importance", "1"); memo.appendItemValue("CopyTo", copyTo); memo.appendItemValue("Subject", subject); // Nu gaan we een MIME entity aanmaken lotus.domino.MIMEEntity body = memo.createMIMEEntity(); // MIME headers aanmaken lotus.domino.MIMEHeader header = body.createHeader("MIME-Version"); header.setHeaderVal("1.0"); header = body.createHeader("Content-Type"); header.setHeaderValAndParams( "multipart/alternative;boundary=\"=NextPart_=\""); // Add plain text part lotus.domino.MIMEEntity child = body.createChildEntity(); lotus.domino.Stream stream = this.m_dominoSession.createStream(); stream.writeText(message); child.setContentFromText(stream, "text/plain", MIMEEntity.ENC_NONE); stream.close(); // Add html part child = body.createChildEntity(); stream = this.m_dominoSession.createStream(); stream.writeText("<html>", Stream.EOL_CR); stream.writeText("<head>", Stream.EOL_CR); stream.writeText("<style>body{font-family:verdana,arial,helvetica,sans-serif}a{c olor:orange}</style>", Stream.EOL_CR); stream.writeText("</head>", Stream.EOL_CR); stream.writeText("<body>", Stream.EOL_CR); stream.writeText(htmlMessage, Stream.EOL_CR); stream.writeText("</body>", Stream.EOL_CR); stream.writeText("</html>", Stream.EOL_CR); child.setContentFromText(stream, "text/html;charset=\"iso-8859-1\"", MIMEEntity.ENC_NONE); stream.close(); // Send Message memo.send(false, sendTo); System.out.println("HTML bericht " + subject + " verzonden."); } catch (NotesException e) { System.out.println("Error - " + e.id + " " + e.text); // e.printStackTrace( System.out ); } finally { try { if (! (memo == null )) { memo.recycle(); memo = null; } this.m_dominoSession.setConvertMime(true); // restore default } catch (NotesException fe) {} } }

      • avatar
      • Byju Joy
      • Fri 21 Aug 2009

      Re: Java version

      Thanks. It works!

    • avatar
    • Lee
    • Fri 11 Jan 2008

    Can I send the created document manually

    Hi Jake et al

    Firstly, happy birthday (33!! mind how you go!!!!! I can't even remember that far back). have a good 'un

    I am using your HTML mail code and have found it extremely useful on 2 or 3 projects already. One thing I'm trying to do though is create the mail with the code and then display it using ws.editdocument before sending it (for proof reading and addition of any other text if required). Now the content comes through as I would expect (nicely formatted tables etc..), but when I send it , the recipient only gets the 'textual' representation of the mail (with the text tables and the content all over the place.)

    So, the question is, is there a way to keep the formatting once I send it from my client?

    Just as an aside - while using this, I needed to turn of the auto insertion of my mail signature as it was putting it above the text rather than below it. The code I came up with may be useful for others (there may be another way but this works)..

    Sub toggleSignature(session As NotesSession,onoff As String) Dim db As Notesdatabase Dim mdb As New NotesDatabase( "", "" ) Dim profile As NotesDocument Call mdb.OpenMail Set db = session.currentdatabase Set profile = mdb.getProfiledocument("CalendarProfile") If Not (profile Is Nothing) Then Select Case onoff Case "1" profile.EnableSignature = "1"

    profile.SignatureOption="2" Case "0" profile.EnableSignature = "0"' profile.SignatureOption="0" End Select Call profile.Save(True,False) End If End Sub

    This I use either side of 'your' sendMessage code.

    Call toggleSignature(Session,"0") 'turn off signature Call sendMessage(vdocument.SendTo(0), subject, htmltext, plaintext) Call togglesignature(Session,"1")'turn on signature



      • avatar
      • Jake Howlett
      • Fri 11 Jan 2008

      Re: Can I send the created document manually

      Thanks Lee!

      ws.editdocument? Isn't that some sort of Notes client code. You should know I don't "do" client here ;o)


      Show the rest of this thread

    • avatar
    • Alan
    • Thu 25 Aug 2011

    As per everyone else's comments, great code. V neat and.

    1 question - I have noticed that uhhh.. mmm... Outlook... does not read the css correctly, and in fact ignores the font... All others seem to be fine. Any thoughts?

    • avatar
    • Doug Finner
    • Fri 16 Mar 2012

    So I'm a bit late to this thread and I gotta tell you that between you and Andre Giruard, you were a ton of help.

    I needed to send out a nicely formatted email that included an attachment and had a variably set of sendTo, copyTo, and blindCopyTo values. Being new to mime and not a big web buy, it's been like playing Zork...I'm still mostly in the dark but have gotten a basic framework that works.

    I've munged your code and Andre's together and post it below.



    'This code sends a mime formatted message with an attachement

    'Code adapted from Andre Giruard @ http://www-10.lotus.com/ldd/bpmpblog.nsf/dx/creating-a-mime-email-with-attachment

    'Additional help from Jake Howlett @ http://www.codestore.net/store.nsf/unid/FISR-6MQSWV?OpenDocument

    'Building a mime based message depends on the order of the mail message build

    'Turn off mime conversion

    'Set mailDoc values like subject, send to, cc, bcc

    'Create mime header

    'Attach files

    'Create plain text message body for those who don't use html mail. It's not displayed for html mail recipients

    'Create html message body for those who do use html. It's not displayed for text only mail recipients

    'Close the stream


    Dim ws As New NotesUIWorkspace

    Dim session As New NotesSession

    Dim db As NotesDatabase

    Dim QuDoSDb As NotesDatabase

    Dim QuDoSView As NotesView

    Dim formDoc As NotesDocument

    Dim deconRT As NotesRichTextItem

    Dim deconAttach As NotesEmbeddedObject

    Dim selUIDoc As NotesUIDocument

    Dim contactName As String

    'Mail variables

    Dim response As Variant 'Provide the user with an option to send mail to the customer directly or to themselves for verification first

    Dim values(1) As Variant

    Dim selDoc As NotesDocument 'Selected document

    Dim mailDoc As NotesDocument 'email with form

    Dim object As NotesEmbeddedObject

    Dim tmpFileName As String 'used to strip underscores and dashes from the original file name

    Dim rawFileName As String 'used as the 'name' in the email attachment.

    Dim attachFilename As String 'full path to the detached form

    Dim sendTo(0) As String 'If you're setting any of these to a single string value, don't declare and just put it into the mailDoc.sendTo field

    Dim copyTo(0) As String

    Dim blindCopyTo(0) as String

    'Mime variables

    Dim body As NotesMIMEEntity

    Dim mh As NotesMimeHeader

    Dim mc As NotesMIMEEntity

    Dim stream As NotesStream

    'Create the mail doc and set the initial values

    Set db = session.CurrentDatabase

    Set selUIDoc = ws.CurrentDocument

    Set selDoc = selUIDoc.Document

    Set mailDoc = New NotesDocument(db)

    session.convertMIME = False '<<<<< - important, this allows us to set the mailDoc values directly outside of the Mime process


    mailDoc.sendTo = |send to here|

    mailDoc.blindCopyTo = |bcc here|

    mailDoc.Subject= |Your subject goes here|

    rawFileName = |put what you want to display as the attachment name here|

    attachFileName = |put the fully qualified path to the file here|

    'Create the MIME headers

    Set body = mailDoc.CreateMIMEEntity

    Set mh = body.CreateHeader({MIME-Version})

    Call mh.SetHeaderVal("1.0")

    Set mh = body.CreateHeader("Content-Type")

    Call mh.SetHeaderValAndParams({multipart/alternative;boundary="=NextPart_="})

    ' create another MIME part for the attachment. (repeat as needed)

    Set mc = body.CreateChildEntity( )

    Set mh = mc.CreateHeader("Content-Disposition")

    Call mh.SetHeaderValAndParams(|attachment; filename=| & rawFileName)

    Set stream = session.CreateStream

    stream.Open attachFileName, "binary"

    Call mc.SetContentFromBytes(stream, "application/octet-stream", ENC_IDENTITY_BINARY)


    'Send the plain text part first (the code was provided as text then html but the site says html then text

    Set mc = body.createChildEntity()

    Set stream = session.createStream()

    Call stream.WriteText("Hello. I'm boring.")

    Call mc.setContentFromText(stream, {text/plain}, ENC_NONE)

    'Now send the HTML part.

    Set mc = body.createChildEntity()

    Set stream = session.createStream()

    'Create the body of the message using HTML here using the format:

    Call stream.WriteText( |Message text in HTML| )

    Call mc.SetContentFromText(stream,{text/html;charset="iso-8859-1"}, ENC_NONE)

    'Close the stream

    Call stream.close()

    'Send it

    Call mailDoc.Send(False)

    Messagebox "Form: " & rawFileName & " has been sent"

      • avatar
      • Jake Howlett
      • Wed 14 Oct 2009

      Did anybody send it you in the end?

Your Comments


Navigate other articles in the category "Miscellaneous"

« Previous Article Next Article »
Putting Style in the Hand of the User   Managing Domino File Resources Using WebDAV

About This Article

Author: Jake Howlett
Category: Miscellaneous
Keywords: MIME; Email; HTML; Alternate;


mimemail.zip (27 Kbytes)


Print Friendly

Let's Get Social

About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »