Mark's right on the money & I've used similar code to do just that.
If you need to let users attach files to Notes documents, you can provide them
a form with a RT field set to "store as MIME and HTML" and then copy the mime
entities from the NotesRichTextItem mime entity to your target mime entity --
let Notes handle the content-type et al.