I use the COM object model to create a simple script for mailing documents as attachments (See below). I found no way of displaying the e-mail before sending it to allow the user to use their contact list for selection the recipient, so for now an input box is used. Can anybody help me to display e-mail or select from the contact list?
Script:
Sub MakeColMail(valArray)
'Create the notes session.
Set session = CreateObject("Lotus.NotesSession")
session.Initialize
Set dir = session.GetDbDirectory("")
Set db = dir.OpenMailDatabase
Set doc = db.CreateDocument ' create a mail DomDocument
receiver = InputBox("Recipient:")
If receiver = "" then exit sub
With doc
Set item = .ReplaceItemValue ( "Form", "Memo" )
Set notesRichTextItem = .CreateRichTextItem( "Body" )
'Add attachments to the message.
Counter = valArray(0)
If Counter = 0 Then
notesRichTextItem.AppendText "Ingen registrerte dokumenter for prosjektet [" & valArray(1) & "]"
ELSE
notesRichTextItem.AppendText "Vedlagt følger prosjektdokumenter for prosjektet [" & valArray(1) & "]"
notesRichTextItem.AddNewLine 1
For i = 1 To Counter
notesRichTextItem.EmbedObject 1454, "", valArray(i + 1) ' EMBED_ATTACHMENT (1454)
notesRichTextItem.AddNewLine 1
Next
End If
Set item = .ReplaceItemValue _
( "Subject", "Prosjektdokumenter for prosjektet [" & valArray(1) & "]" )
Set item = .ReplaceItemValue ( "SendTo", receiver )
Call doc.Send(True, receiver)
End With
End Sub

