I’m trying to put some HTML into every outgoing email my client sends (formatted text and a URL reference to an image on the corporate server).
Thanks to Rod Whitely, I’ve figured out to get HTML in an outbound email using CreateMIMEEntity. But the code I use to do this tries to create a brand new Body field, which of course results in an error (Item body already exists) when it runs since there’s already a Body field on the Memo.
How do I concatenate the new MIME Entity with my existing Body field?
Here’s my sample code, in the QuerySave event of my memo:
Sub Querysend(Source As Notesuidocument, Continue As Variant)
Dim doc As NotesDocument
Set doc = Source.Document
htmltext$ = {My Company<br>
123 My St.
My Town, MyState 12345
Phone: 123-456-7890 Fax: 123-456-7891
Email: me@my_company.com
src=“http://www.my_company.com/database.nsf/mylogo.jpg?openImageResource”
Dim session As New NotesSession
Dim html As NotesStream
Set html = session.CreateStream
html.WriteText htmltext$
Dim mime As NotesMIMEEntity
Set mime = doc.CreateMIMEEntity("Body")
mime.SetContentFromText html, "text/html", ENC_NONE
End Sub
I tried replacing it with this, in which I try to create different rich text and MIME entities and concanetate them, but it doesn’t work:
Sub Querysend(Source As Notesuidocument, Continue As Variant)
Dim doc As NotesDocument
Set doc = Source.Document
htmltext$ = {My Company<br>
123 My St.
My Town, MyState 12345
Phone: 123-456-7890 Fax: 123-456-7891
Email: me@my_company.com
src=“http://www.my_company.com/database.nsf/mylogo.jpg?openImageResource”
Dim rtitem1 As Variant
Dim rtitem2 As Variant
Dim session As New NotesSession
Dim html As NotesStream
Set html = session.CreateStream
html.WriteText htmltext$
Dim mime As NotesMIMEEntity
Set mime = doc.CreateMIMEEntity("Body2")
mime.SetContentFromText html, "text/html", ENC_NONE
Set rtitem1 = doc.GetFirstItem( "Body" )
Set rtitem2 = doc.ReplaceItemValue("Body", rtitem1 & Body2 )
End Sub
Thanks very much in advance.