AW: Lotus Notes
08.02.2007 19:15:13
Samuel
Hallo Peter,
ich nutze dazu folgende Funktion, die ich mir hier aus diesem Forum und von anderen Seiten zusammenkopiert habe. (also .copyto und .blindcopyto)
Public
Function LotusNotesMail(Subject As String, Attachment As String, Empfaenger As String, Kopie As String, _
BlindKopie As String, BodyText As String, SaveIt As Boolean)
Dim Maildb As Object 'Die Mail-Datenbank
Dim UserName As String 'Der Notes-Benutzername des SENDENDEN Users
Dim MailDbName As String 'Der Name der Maildatenbank des SENDENDEN Users
Dim MailDoc As Object 'Das Mail-Dokument selbst
Dim AttachME As Object 'Das Attachment-Richtextfile-Object
Dim Session As Object 'Die Notes-Session
Dim EmbedObj As Object 'Das Attachment
'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
MailDoc.Form = "Memo"
MailDoc.sendto = Empfaenger
MailDoc.copyto = Kopie
MailDoc.blindcopyto = BlindKopie
MailDoc.Subject = Subject
MailDoc.body = BodyText
MailDoc.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CreateRichTextItem("Attachment")
Set EmbedObj = AttachME.EmbedObject(1454, "", Attachment, "Attachment")
'MailDoc.CREATERICHTEXTITEM ("Attachment")
End If
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0, Empfaenger
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Function
Sub rausdamit()
Dim dummy As Variant
dummy = LotusNotesMail("Betreff", "C:\temp\Anhang4X.xls", "Emfaenger@web.de", "Kopie@web.de", _
"BlindKopie@web.de", "Mailtext" & Chr$(10) & Chr$(10) & " ", True)
End Sub
Gruß
Samuel