Problem to send html email

Hello

I try to send an html email and I always have the same error.

It’s strange because I’ m using a designer sample.

Error in log.nsf

Line number 43 : Erreur: 91 - Object variable not set

My Code

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim doc3 As NotesDocument

Dim item As NotesItem

Dim ret As Variant

Dim mailbody As NotesRichTextItem

Dim link1 As String

Dim body As NotesMIMEEntity

Dim header As NotesMIMEHeader

Dim stream As NotesStream



On Error Goto erreur



Set stream = session.CreateStream

session.ConvertMIME = False ' Do not convert MIME to rich text



Set db = session.CurrentDatabase

Set doc = db.CreateDocument



'Récupération des données reçues

Set doc3 =  db.GetDocumentByUNID(pdocUnid)		



' Eclatement de tous les destinataires en tableau pour chargement en 

liste dans SentTo

ret = Split(pRecipients, ",")

doc.SendTo = ""

Set item = doc.GetFirstItem( "SendTo" )



Forall p  In ret

	Call item.AppendToTextList(p)

End Forall



Call doc.ReplaceItemValue("Form", "Memo")

Set body = doc.CreateMIMEEntity

Set header = body.CreateHeader("Subject")

Call header.SetHeaderVal("MIME multipart message")

Set header = body.CreateHeader("To")

Call header.SetHeaderVal("William Grant")           <== error :Object variable not set

Call stream.WriteText("Text of message.")



Call body.SetContentFromText _

(stream, "text/plain;charset=UTF-8", ENC_NONE)  

Call doc.Send(False)

session.ConvertMIME = True ' Restore conversion

thanks in advance

Nicolas