Send mail/fax in script

I need to fax selected documents to the faxnbr which is in each document. The code I’m using for this is written below. However , it’s not clear to me how I should set the value of doc(for the document which I have to fax) and maildoc (for sending the fax itself). …and if I really have to use db.CreateDocument ?..

Can someone put these things straight for me?

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim maildoc As NotesDocument

Dim rtitem As NotesRichTextItem

Set db=session.CurrentDatabase

Set doc = ???

Set maildoc = db.CreateDocument

maildoc.Form = “Memo”

maildoc.SendTo=doc.FAXnr(0)

maildoc.copyTo=“”

maildoc.BlindCopyTo=“”

maildoc.Subject = “blabla”

Set rtitem = New NotesRichTextItem( mailDoc, “Body” )

Call rtitem.AppendText(“Dear,” )

Call rtitem.AddNewLine(2)

Call rtitem.AppendText( “Best regards.” )

Call rtitem.AddNewLine(1) …

Call rtitem.AppendText(" ")

Call maildoc.Send(True)

Call doc.save(True,True)

Call doc.Close

End Sub

Thx