How to attach the document

Hi,

I wrote the JS codes(Sending Email) in Domino Designer as shown below. My problem is want to attach the current domino document form(with values) with the mail. What should I do? What component do i need to use. My project is with Xpage(Web based). Plz help me. thanks.

db1 = session.getDatabase(“sporlt02003.aspa.attww.local”,“MyWeb.nsf”)

doc1 = db1.createDocument()

var1 = "User: " + @Text(document1.getItemValueString(“txtuser”))

var3 = “Hi This is from” + var1

body = doc1.createMIMEEntity()

subject = body.createHeader(“Subject”)

subject.setHeaderVal(“subject”)

stream = session.createStream()

stream.writeText(var3)

body.setContentFromText(stream, “text/html; charset=iso-8859-1”, 0)

doc1.send(“Email Address”)

Subject: Documents are not files

About the only way to treat a document as a file (i.e. to Attach it to another document) is to create a OND (One Note Database) from it. Then, when launched, it will open that database/document in the recipients Notes client.