Sending files from folder using lotusscript -- but no attachments in the sending email ?!

Hi,I use the following code to get files out of a special folder and send it to a special recipient.

But I´ve the problem, that the files are not stored in the email. So the I get the email without the attachments , only with the text in the body-field.

The agent with this code produces no error –

What´s wrong with the lotusscript code ?

Need your help, because my ls knowledge is not so good.

Thanks in advance, Steffi


Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim object As NotesEmbeddedObject

Dim recipient As String

Dim pathName As String, fileName As String

Set db = session.CurrentDatabase

Set doc = New NotesDocument( db )

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

Call rtitem.AppendText(“XXX”)

Call rtitem.AddNewLine( 2 )

Call rtitem.AppendText(“>>XXX.<<”)

Call rtitem.AddNewLine( 2 )

pathName$ = “/home/skrueger”

fileName$ = Dir$(pathName$, 0)

Do While fileName$ <> “”

fileName$ = Dir$()

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, “”, “/home/skrueger” & fileName$)

Loop

recipient = “s.krueger@aswo.com”

doc.Principal = “CN=Info/O=aswo”

doc.SendTo = recipient

doc.Form = “Memo”

doc.Subject = “TEST”

Call doc.Save( False, True )

Call doc.Send( True )

End Sub

Subject: sending files from folder using lotusscript – but no attachments in the sending email ?!

Shouldn’t this line:

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, “”, “/home/skrueger” & fileName$)

Have a second forward-slash after skrueger? Like this:

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, “”, “/home/skrueger/” & fileName$)

Emily.

Subject: RE: sending files from folder using lotusscript – but no attachments in the sending email ?!

Hi Emily,makes no difference.

Now attachments in the email.

Steffi

Subject: RE: sending files from folder using lotusscript – but no attachments in the sending email ?!

Try changing this section:

Do While fileName$ <> “”

fileName$ = Dir$()

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, “”, “/home/skrueger” & fileName$)

Loop

To this:

Do While fileName$ <> “”

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, “”, “/home/skrueger” & fileName$)

fileName$ = Dir$()

Loop

Otherwise you will always miss the first file in the folder, and it will always throw an error when there are no more files.

Emily.