I am currently working on an agent that will take a plain text field from a form an ammend html tags to it. I have got this part working properly the problem I have now is that when I send an email with this html text in a richtextitem named “body” then html doesn’t get converted. I have been looking back at the old posts regarding mime and the codestore articles on html email, but they seem a bit over my head. Can anybody help?
Subject: Including html in emails
I never could get working using NotesRichTextItem - have to use NotesMimeEntity and NotesStream to create ‘Body’ field. Here is some sample code that may help:
’ Create Body field
Set body = maildoc.createmimeentity
Set stream = session.createstream
Set header = body.CreateHeader(“MIME-Version”)
Call header.SetHeaderVal(“1.0”)
Set header = body.CreateHeader(“Content-Type”)
Call header.SetHeaderValAndParams(|multipart/related;boundary=“bounds”|) ’ Parts are components of a single document (for example, an HTML page and the images in that page).
Set mimeText = body.CreateChildEntity
’ Create Title and Intro Paragraph
Call stream.WriteText(AuthRepSettingDoc.CSS(0)) ’ add Cascading Style Sheet information from Settings document
'Call stream.WriteText(|
|+"Report Title for: " +nam.Common+|
|)'Call stream.WriteText(|
|+AuthRepSettingDoc.IntroTitle(0)+|
|)Call stream.WriteText(|
|+AuthRepSettingDoc.IntroParagraph(0)+|
|)Call stream.WriteText(|
Executive Summary
|)Call stream.WriteText(|
|)<< more code >>
’ and Closing
Call stream.WriteText(|
|+AuthRepSettingDoc.FooterParagraph(0)+|
|)session.ConvertMime=True
Call mimeText.SetContentFromText(stream,“text/html;charset=iso-8859-1”,ENC_QUOTED_PRINTABLE)
This is the basic format that I use for creating ‘HTML eMails’. The content of my HTML body is being read from fields on a Profile Document.
| |+“Lab”+| | |+“Submissions”+| | |+“Usage”+| |