Help with MIME Content-Type/Encoding

Hi,

I’m working on an application that will allow a user to embed a graphic in a rich text field, and send that graphic in an email via Notes. To do this, I’m currently using a two-step process: converting the contents of the rich-text field to HTML, and then feeding that HTML to the NotesMIMEEntity classes as a stream. For converting to HTML, I’m using an excellent script library found at nsftools.com in a database called “RT2HTML”. In the case of a rich text field with graphics, the graphic is returned as part of a long HTML string. But when feeding this HTML as a stream, I need a way to tell the NotesMIMEEntity to convert the document back to a graphic. Here’s the code I’m using for that part:

============================

Function CreateAndSend (s As NotesSession,msg_text As String,msg_html As String,Recipient As String,Originator As String, Subject As String)

Dim m_doc As New Notesdocument(db_this)

s.ConvertMIME = False 

Set stream = s.CreateStream

Set body = m_doc.CreateMIMEEntity 

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

Call header.SetHeaderVal("multipart/alternative") 

Set header = body.CreateHeader("Subject")

Call header.SetHeaderVal(Subject) 

Set header = body.CreateHeader("To")

Call header.SetHeaderVal(Recipient) 

Set child2 = body.CreateChildEntity

Call stream.WriteText(msg_text)

Call child2.SetContentFromText(stream,"text/plain;charset=iso-8859-1",ENC_NONE)

Call stream.Close 

Set child3 = body.createchildEntity

Call stream.WriteText(msg_html)

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

Call stream.Close

m_doc.Principal = Originator '## the spoofing

Call m_doc.Save(True, True)

s.ConvertMIME = True '## Restore conversion

sending:

m_doc.Send False

Sleep(1) '## to reduce the load on the server, it sleeps for one second between sendings

Exit Function

End Function

==========================

Is this done with content type or encoding? As you can see above, I’m currently using “multipart/alternative” content-type and no encoding. I saw in Notes Help how to change the encoding and what values were allowed, but I saw nothing that explained what encoding method was good for what situation.

Could someone here who’s a little more knowledgeable about MIME help me out, or point me to a good resource where I can find out more about this?

Thanks in advance.