Hello,
we want to write an agent, that sends a newsletter by internet-mail to the recipients.
For the newsletter there are two versions existing. One with html, the second as plain text for those users who are not able to view html.
Till now I have the follwing testing code to send the newsletter:
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim body As NotesMIMEEntity
Dim child As NotesMimeEntity
Dim header As NotesMIMEHeader
Dim stream As NotesStream
Set db = s.CurrentDatabase
Set stream = s.CreateStream
s.ConvertMIME = False ' Do not convert MIME to rich text
Set doc = db.CreateDocument
Call doc.ReplaceItemValue("Form", "Memo")
Set body = doc.CreateMIMEEntity
Set header = body.CreateHeader("Subject")
Call header.SetHeaderVal("subject MIME message")
Set header = body.CreateHeader("To")
Call header.SetHeaderVal("me@acme.com")
Set child = body.CreateChildEntity
Call stream.WriteText("<h1>header</h1>", EOL_CRLF)
Call child.SetContentFromText(stream, "text/html;charset=UTF-8", ENC_NONE)
Call stream.Truncate
Set child = body.CreateChildEntity
Call stream.WriteText("plain text version newsletter", EOL_CRLF)
Call child.SetContentFromText(stream, "text/plain;charset=UTF-8", ENC_NONE)
Call doc.Send(False)
s.ConvertMIME = True ' Restore conversion
End Sub
The problem is, I want to display only one version at a time. But with the code above both versions are displayed in the mailclient. (Additionally: Thunderbird displays an attachment!?)
Any suggestions how to “hide” one version?
Thanks
Joerg