Newsgroup: it.comp.lang.visual-basic
Titolo: messaggio lotus tramite VB

Ho una applicazione in vb e dovrei aprire via codice un nuovo
messaggio di posta di lotus notes, gią precompilato in alcuni campi e
con qualche file in allegato, pronto da spedire&#8230; la mail
dovrebbe essere ovviamente visibile perché l&#8217;utente deve poter
selezionare l&#8217;address ecc&#8230;
qualche idea?
Grazie 
matteo

try this
'This is a combination of a number of routines for sending an Notes
Email
'from Visual Basic. This works on Notes 4.x and 5.x (at least up to
5.06a).
'Lotus Notes must be installed on the computer which will run this
code.
'Parameters for the routine are:
'Subject : String - Can be a comma seperated list of addresses.
'Attachement : String - Can be a pipe (|) delimited list of fully
qualified filenames
'BodyTest : String - Nothing to say, just a string as long as you like
'CC : String - Can be a comma seperated list of addresses. (Optional)
'BCC : String - Can be a comma seperated list of addresses. (Optional)
'SaveIt : Boolean - Set to True to save in the Sent Folder after
sending (Optional)
Public Sub SendNotesMail(Subject As String, Attachment As String,
BodyText As String, SendTo As String, Optional CC As String = "",
Optional BCC As String = "", Optional SaveIt As Boolean = False)
 
    'Set up the objects required for Automation into lotus notes
    Dim Maildb As Object 'The mail database
    Dim UserName As String 'The current users notes name
    Dim MailDbName As String 'THe current users notes mail database
name
    Dim MailDoc As Object 'The mail document itself
    Dim intAttach As Integer
    Dim Session As Object 'The notes session
    Dim EmbedObj As Object 'The embedded object (Attachment)
    Dim Server As String
 
    'Start a session to notes
    Set Session = CreateObject("Notes.NotesSession")
    Server = Session.GetEnvironmentString("MailServer", True)
    MailDbName = Session.GetEnvironmentString("MailFile", True)
    UserName = Session.UserName
 
    'Open the mail database in notes
    Set Maildb = Session.GetDatabase(Server, MailDbName)
    'Set up the new mail document
    Set MailDoc = Maildb.CreateDocument
    With MailDoc
        .Form = "Memo"
        .EnterSendTo = SendTo
        .EnterCopyTo = CC
        .EnterBlindCopyTo = BCC
        .Subject = Subject
        .SaveMessageOnSend = SaveIt
        'Set up the embedded object and attachment and attach it
        Dim aryAttachment() As String
        aryAttachment = Split(Attachment, "|")
        Dim ric As Object
        Set ric = .CreateRichTextItem("Body")
        ric.AppendText BodyText & Chr$(13)
        For intAttach = LBound(aryAttachment) To UBound(aryAttachment)
          Set EmbedObj = ric.EmbedObject(1454, "",
aryAttachment(intAttach), "Attach")
        Next intAttach
        .Save False, False
        'Send the document
        '.PostedDate = Now() 'Gets the mail to appear in the sent
items folder
        '.Send False
 
    End With
    DoEvents
    Dim ws As Object
    Set ws = CreateObject("notes.notesuiworkspace")
    DoEvents
    ws.OpenDatabase Server, MailDbName
    ws.EDITDOCUMENT True, MailDoc
 
    'Clean Up
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set ric = Nothing
    Set ws = Nothing
    Set Session = Nothing
    Set EmbedObj = Nothing
 
End Sub