|
-
August 14th, 2001, 02:03 AM
#1
creating Lotus Notes mail with VB
Hi all,
I need to send mail with attachment with default mail client.. Ms Outlook or Lotus Notes.
I have to open composing window with attached file.
With Ms Outlook it is ease and there are no problems.
Here found some VB code for mail sending with Lotus Notes:
public Sub SendNotesMail(Subject as string, Attachment as string, Recipient as string, BodyText as string, SaveIt as Boolean)
'//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)
'//Start a session to notes
set Session = CreateObject("Notes.NotesSession")
'//Open the mail database in notes
set Maildb = Session.getdatabase("", "")
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 = Recipient
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")
End If
'//Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0, Recipient
'//Clean Up
set Maildb = nothing
set MailDoc = nothing
set AttachME = nothing
set Session = nothing
set EmbedObj = nothing
End Sub
I know that I have to crete Notes.NotesUIWorkspace and Notes.NotesUIDocument object to make this MailDoc visible, but I couldnt.
Please help me to put this document in editing form.
S.
-
August 31st, 2001, 10:44 AM
#2
Re: creating Lotus Notes mail with VB
you need a few extra line of code hich are similar to
dim uidoc as NotesUIDocument ' identifies your User document
dim ws As New NotesWorkspace ' create a workspce for your uidoc
//your code goes here
'this line of code puts the maildoc into editmode
set uidoc = ws.editdocument(true, maildoc)
'control is now passed to the user in lotus notes
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|