Sending Formatted SMTP email - partial solution

I have seen some discussion of this but no one has posted their results, so I am posting mine (code using new NotesMIMEEntity below allows sending a hyperlink).

I am attempting to send a detailed receipt for a commerce site. With the code below I could send the HTML to create this detailed page, however that is a lot of HTML to incorporate into an agent and if the customer wants the ‘receipt’ to change, not only do I change the receipt subform that is displayed to the user on submitting their order, but I would also have to change the HTML in the agent - BAD. If I could RenderToRichText (the actual receipt document) and then send it as MIME then I would be ecstatic.

The code below is creating a memo (memo) from values on the order doc (doc). Doc.MyBody(0) contains some text (with @char(10) embedded in several places) AND the HTML for a hyperlink. The hyperlink mails correctly (and by extension, it is safe to assume that ?all? HTML would mail correctly). The @Char(10) are stripped out. I tried also using
but this was also stripped out.

Any thoughts/feedback are encouraged as my MIME knowledge is very limited,

Marc Robson

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Set db = session.CurrentDatabase

Set doc = Session.DocumentContext



session.ConvertMIME = False 



Dim memo As New NotesDocument(db)

memo.Principal = "me@anydomain.com" + "@NotesDomain"

memo.SendTo = doc.mysendto(0)

memo.CopyTo = doc.mycopyto(0)

memo.BlindCopy = doc.myblindcopy(0)

memo.Subject = doc.mysubject(0)



Dim body As NotesMIMEEntity

Dim stream As NotesStream

Set body = memo.CreateMIMEEntity

Set stream = session.CreateStream

Call stream.WriteText(doc.mybody(0))

Call body.SetContentFromText(stream, "text/html",ENC_NONE)

Call stream.Truncate



session.ConvertMIME = True



Call memo.send(False)