Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create Lotus Notes mail for editing 1

Status
Not open for further replies.

jimlee

Programmer
Jan 27, 2001
213
GB
Hi,

Could someone tell me if it is possible to create a lotus notes mail, insert address / subject and some text and then leave the document open for the user to edit?

I have managed to send a mail from lotus using vbs but not have it open for editing.

I have scoured this site and the internet but can't find anything that will help me.

any help on this much appreciated.



jimlad

"There's this thing called being so open-minded your brains drop out." - Richard Dawkins
 
do you have a link to where the lotusnotes object model can be found?
does lotusnotes application have something similar to outlook where you can use the vba editor to search the object model?
do you have some sample code for connecting to the lotus notes COM object?
 
Hi Thanks for the reply...

object model....
there is no vba editor that i know of in lotus notes,

the only code I have so far for manipulating lotus is below, this will send a mail for you and works fine, i need to have the document visible however, so that the user can edit before it is sent. This is where i'm having trouble.
Code:
' Name : SendNotesMail
' Function: Send a Mail using Lotus Notes
' Author : Alain Aucordier (alain.aucordier@socgen.com)
' Created : 19/04/2001. Copyright 2001@ArtOfNet 
Call SendNotesMail( "this is the script to send the mail via the script !!" , "C:\Documents and Settings\U387753\Desktop\sendMail_Lotus.txt" , "myemail@domain.com","my message" , True)
Sub SendNotesMail(Subject , Attachment , Recipient , BodyText , SaveIt )
'Set up the objects required for Automation into lotus notes
Dim Maildb          'The mail database
Dim UserName      'The current users notes name
Dim MailDbName      'THe current users notes mail database name
Dim MailDoc      'The mail document itself
Dim AttachME      'The attachment richtextfile object
Dim Session      'The notes session
Dim doc
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
Set Maildb = Session.GETDATABASE("", MailDbName)
'Set Maildb = Session.GETDATABASE("", "mail.box")
If Maildb.ISOPEN = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
Set doc = Maildb.CREATEDOCUMENT
Dim EmbedObj      'The embedded object (Attachment)

'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 up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Recipient
MailDoc.Subject = Subject
MailDoc.Body = BodyText & chr(10) & "hello"
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.SEND 0, Recipient
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub

jimlad

"There's this thing called being so open-minded your brains drop out." - Richard Dawkins
 
Hi jimlee,
I would be interested in a solution as well, if you've found one. Thanks,
 
Hi ChiBlues,

i've only just noticed this thread, i managed to get the document to go to my drafts folder which served my purpouses fine, i can't remember the code now but i have it in work. Unfortunately I've just finished for the weekend so i'll post it on monday for you

jimlad

"There's this thing called being so open-minded your brains drop out." - Richard Dawkins
 
Hi,

this a template of what I used

Code:
on error goto 0
Dim session
Dim db

'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
Set db = session.CurrentDatabase

Dim doc
DIM ANSWER
dim SUBJECTSTR
DIM X
SUBJECTSTR = "DATAFIX - "
Set doc = db.CREATEDOCUMENT
Call doc.AppendItemValue("From", "this appears next to the date at the top left of the mail")
call doc.appenditemvalue("EnterSendTo", "email address here")
call doc.appenditemvalue("EnterCopyTo", "cc: email addresses here")
Call doc.AppendItemValue("Subject", "subject goes here")

Set richText = doc.CreateRichTextItem(doc,"Body")
Dim richStyle
'DO THE INTRODUCTION
Set richStyle = session.CreateRichTextStyle
Call richText.AppendText("Hi" & chr(10))
Call richText.AppendText("This is some text in the body of the mail." & chr(10) & chr(10))
Call richText.AppendText("This is another line of text " & chr(10) & chr(10))
call richText.AppendText("Regards Jamie.")
'save it
Call doc.Save(True, False)
MSGBOX "THE MAIL HAS NOT BEEN SENT YET, IT WILL BE IN YOUR DRAFT FOLDER" & CHR(10) & "PLEASE CHECH IT BEFORE SENDING"



jimlad

"There's this thing called being so open-minded your brains drop out." - Richard Dawkins
 
Jamie,

Its in vb6 but Lotus Notes Body Text/ Email VB
thread222-766157 may interest you.

Hugh,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top