Emailing an attachment in Lotus Notes

peterlee516

Registered User.
Local time
Yesterday, 20:16
Joined
Nov 29, 2007
Messages
36
Hi,

I have this code that sends out an email from Lotus Notes (works great!). I just need to figure out how to attach a form or a report. Does anyone know where to add the report/forn name?

Thank you in advance.


Public Sub SendLotusNotesMail(strMailTitle As String, strLotusNotesUserID As String, strTextBody As String, Optional strFileAttachment As String = "", Optional fSaveMailToTheSentFolder As Boolean = True)

Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object

Dim strMailDbName As String

On Error Resume Next

'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")

'Open the mail database in Lotus Notes
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL

'Set up the new mail document
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.sendto = strLotusNotesUserID
objMailDocument.Subject = strMailTitle
objMailDocument.Body = strTextBody
objMailDocument.SAVEMESSAGEONSEND = fSaveMailToTheSentFolder

'Set up the embedded object and strFileAttachment and attach it
If strFileAttachment <> "" Then

Set objAttachment = objMailDocument.CreateRichTextItem("strFileAttachm ent")
Set objEmbedObject = objAttachment.EmbedObject(1454, "", strFileAttachment, "strFileAttachment")

End If

'Send the document
objMailDocument.SEND 0, strLotusNotesUserID

'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing

End Sub
 

Users who are viewing this thread

Back
Top Bottom