Hello KIFFI
Your "avatar" always scare me..., but i'm always glad to call you
Well, i POST all the snippet i have.
It's probabbly the same, but if a line can help you ....
I don't use it, but a friend use it fine
Thanks for your quick answer
First code
Code: Alles auswählen
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/Lotus_SmartSuite/Lotus_Notes/Q_20248333.html
Hope someone can give me some direction on this. I have the task of programming the sending of automated e-mail from A97 in a Lotus Notes/Domino enviroment. I started off using the the following code:
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 AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim intAttach As Integer
Dim intAttachments As Integer
Dim strAttachmentName As String
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string
UserName = Session.UserName
MailDbName = left$(UserName, 1) & right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
With MailDoc
.Form = "Memo"
.SendTo = SendTo
.CopyTo = CC
.BlindCopyTo = BCC
.Subject = Subject
.Body = BodyText
.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and attachment and attach it
intAttachments = dhCountTokens(Attachment, ",")
For intAttach = 1 To intAttachments
strAttachmentName = dhExtractString(Attachment, intAttach, ",")
Set AttachME = .CREATERICHTEXTITEM("Attachment" & CStr(intAttach))
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", strAttachmentName, "Attachment" & CStr(intAttach))
.CREATERICHTEXTITEM ("Attachment" & CStr(intAttach))
Next intAttach
'Send the document
.PostedDate = Now() 'Gets the mail to appear in the sent items folder
.send False
End With
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub
But this had the main dis-advantage of prompting for a password (hence no automation and leaving the password blank is not really an option. After reading some docs, I discovered that it was impossible to send the password with the OLE automation method above. It also had the drawback of requiring the notes client to be installed and firing up the client in memory everytime a message was sent.
After some more leg work, I discovered the Lotus Domino Objects COM interface where I could talk directly to the Domino server. I've managed to get to the point where I can create a document (see code below) in the users mail database, but it appears I need to format the document as a "mail document" (my term), which is something that the notes client normally does.
The COM object doesn't support the .Form, .SendTo, .Body, etc properties, so it appears that I need to format the document myself via internal fields. However the COM doc's are poor and I can't find any examples of how I might go about filling this document with fields.
Can anyone point me to doc's on documents or explain how they are internally formatted? The e-mails I send will have attachements.
Jim.