[2008] Send email via Lotus Notes
Hi all,
I am trying to send an email using Lotus Notes and have it include an attachment. I have found the below the code which works but what I would like to do is have the email still open for editing before it is sent.
Code:
Sub SendByNotes()
Dim Session As Object, DB As Object, Memo As Object
Dim Server$, Mailfile$
Dim Item As Object
Dim strSubject, strDest, strCopy, strFilename
strSubject = "Test Memo sent at" & Now()
strDest = "Destination"
strCopy = "Copyto"
strFilename = "C:\test.doc"
Session = CreateObject("Notes.NotesSession") ' Creates a Notes Session()
Server$ = Session.GETENVIRONMENTSTRING("MailServer", True) ' Read the current mail server from Notes.ini
Mailfile$ = Session.GETENVIRONMENTSTRING("MailFile", True) ' Read the current mail file from Notes.ini
DB = Session.GETDATABASE(Server$, Mailfile$) ' Try to open the mail database()
If Not DB.IsOpen Then
MsgBox("Could not access Notes mail file!") ' If Mail db not accessible, return an error
Exit Sub
End If
Memo = DB.CREATEDOCUMENT 'Create a memo in the user() 's mail file
Memo.Form = "Memo" 'Set the form to be a mail(memo)
Memo.from = Session.UserName 'Set the from field (not necessary)
Memo.sendto = strDest 'Set the recipient of the(memo)
Memo.copyto = strCopy
Memo.Subject = strSubject 'Give the memo a subject()
Item = Memo.CREATERICHTEXTITEM("Body")
Call Item.EMBEDOBJECT(1454, "", strFilename) 'Go to the body of the memo and embed the attachement
Call Memo.Save(True, False) 'Save the memo in drafts()
Call Memo.SEND(False, False) 'Send the memo
Memo = Nothing
DB = Nothing
Session = Nothing
MsgBox("Attachment sent. You may close Notes.")
End Sub
I have tried adjusting the Call Memo.SEND(false,false) but nothing has changed.
Any help would be grately appreciated.
-MadCat