Mail sending with several attachments

I have a question: Is it possible to create such an agent that would perform such task on schedule (for instance, daily): get all files from some folder, attach them to an empty message and send to some specified address. The main question is: is it possible to get ALL files from that folder (these files are generated automatically) to be attached?

Then, is there a possibility for an agent to dump all attachments from messages that come to a specific address into some folder?

Any information on this subject is appreciated. :slight_smile:

Subject: Mail sending with several attachments

Yes. Here is an example from designer help. use a combination of the two. Should get you started.1.

Reading files from directory

Dim session As New NotesSession

Dim stream As NotesStream

Set stream = session.CreateStream

files& = 0

bytes& = 0

directory$ = “C:\StreamFiles”

Chdir directory$

file$ = Dir$(“.”)

While file$ <> “”

If Not stream.Open(path$ & file$) Then

  Messagebox file$,, "Open failed"

  Exit Sub

End If

files& = files& + 1

bytes& = bytes& + stream.Bytes

Call stream.Close

file$ = Dir$()

Wend

Messagebox "Number of files = " & files& & Chr(13) & _

"Total bytes = " & bytes&, "Normal files in " & directory$

End Sub

This agent embeds attachments

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim object As NotesEmbeddedObject

Set db = session.CurrentDatabase

Set doc = New NotesDocument( db )

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

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, “”, “c:\jim.sam”)

doc.Form = “Main Topic”

doc.Subject = “Here’s Jim’s document, as an attachment”

Call doc.Save( True, True )

Subject: Mail sending with several attachments

Hi,

Please see the following codes:

Set rtfItem = New NotesRichTextItem(rtfChildDoc, “fld_NotesImage” )

Set object = rtfItem.EmbedObject( EMBED_ATTACHMENT, “”, Source.FieldGetText(“fld_ImgFileName”))

Call rtfChildDoc.MakeResponse(Source.Document)

Call rtfChildDoc.Save(True,True)

  1. Please build a profile document with using similar to “System Preferrences”.
  • Archive the name of indicated folder which contains files you want to collect into mailing documents.

  • Archive the list of mailing addresses.

  1. You write some codes to find and get all file names in the indicated folder into an array. From that array, you use the above code to create a rich-text field containing all files which collect from the indicated folder.

  2. More detail, please refer:

  • NotesRichTextItem class.

  • NotesRichTextDocLink class.

  • NotesRichTextNavigator class.

  • NotesEmbeddedObject class.

Good luck!