How to send mime e-mail with attachments (no acces file system)?

hi

i need to send a html e-mail (mime ) with attachments but I didn’t have access to the file system to detach the file. if i have my file in a $file field, How i move the file to the body (mime entity)?. i see the stream class but didn´t work because took the files from the

file system. please help me

thanks in advance

Juan Manuel

Subject: XML to the rescue

Hi Juan,LotusScript doesn’t allow you to stream an attachment directly to memory. (To be precise: the NotesEmbeddedObject class doesn’t allow it. So this applies to Java too).

However you can stream the whole content into DXL. This nicly does the encoding for you. A little XLST to strip the stuff you don’t need and there you go.

Caveat: You might stresstest your server if your files are big.

Hth

:wink: stw

Subject: re:XML to the rescue

Hi Stephan, thanks for the help

I am afraid I have never do this before. do you have some sample code to understand this

regards

Juan Manuel

Subject: RE: re:XML to the rescue

Hi Juan,

it is easier as it sounds:

… let’s asume you have doc as NotesDocument

… and the XLST in a String variable curStyle

… and s is you NotesSession

Set xStyle = s.CreateStream

Call xStyle.WriteText(curStyle)

xStyle.Position = 0

'Now get the DXL… and transform

Set xTrans = s.CreateXSLTransformer

Call xTrans.SetStylesheet(xStyle)

Dim xResult As NotesStream

Set xResult = s.CreateStream

Call xTrans.SetOutput(xResult)

Set dxlSource = s.CreateDXLExporter(doc,xTrans)

'Only the process needs to be called, the transform is implicit

Call dxlSource.process


Now you have the result in xResult and can do whatever you want with it. Java is very similar.

The content of curStyle is more tricky. You need to know XLST and DXL.

For starters have a look at http://www.w3schools.com to learn XLST. Start with a stylesheet that has only two entries

<xsl:stylesheet match = “/”>

<xsl:apply-templates select=“//dxl:item”/>

</xsl:stylesheet>

<xsl:stylesheet match = “*” />

(the select clause is the tricky one. I’m away from my office machine now. PM me for more help)