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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Lotus Notes Mail from PB application

Status
Not open for further replies.

sugataghosh

Programmer
Jan 3, 2003
1
US
I wanted to know if there is a way to send lotus nots email from a PB application. I am trying with the mail session object but it always is trying to invoke the outlook express. How to tell the application to send by Lotus notes?
 
Hi,

Try playing with this code. It's messy and I haven't included half of the variables needed but hey, it's a jungle out here.

Also, this method does not start the Notes application on the user's machine.

Code:
/* initialisation */
Integer li_ret 

invo_NotesSession = CREATE OLEObject
li_ret = invo_NotesSession.ConnectToNewObject("Notes.NotesSession")
... do your checks....

/* send the email */
OleObject ole_database, ole_document, ole_richtext, ole_attach

ls_user = invo_NotesSession.GETENVIRONMENTSTRING("MailFile", True)
ls_server = invo_NotesSession.GETENVIRONMENTSTRING("MailServer", True)
ole_database = invo_NotesSession.GETDATABASE(ls_server, ls_user)
ls_title = ole_database.Title
If IsNull(ls_title) OR Len(Trim(ls_title)) < 1  Then
	gnv_app.of_errmsg(&quot;Notes communication error!~n~rYou may need to log onto notes before proceeding!&quot;)
	Return  -1
End If
ole_document = ole_database.CREATEDOCUMENT
ole_richtext = ole_document.CREATERICHTEXTITEM(&quot;Body&quot;)

ls_recipients[1] = as_to[1]

ls_text = as_text + &quot;~n~r~n~r&quot;
ole_richtext.APPENDTEXT(as_text)

li_attachments = UpperBound(as_attach[])

For li_count = 1 To li_attachments
	 ls_attach = as_attach[li_count]
	 ole_attach = ole_richtext.EMBEDOBJECT(1454, &quot;&quot;, ls_attach)
Next

ole_document.Form = &quot;Memo&quot;
ole_document.Subject = as_subject
ole_document.sendto = ls_recipients
ole_document.posteddate = DateTime(Today(), Now())
ole_document.Save( True, False, True)
ole_document.SEND (False, ls_recipients)

Destroy invo_NotesSession

Cheers.
 
Thanks for that help (which helps me too !!)

I developp my own library for using oleobject (and avoiding errors), but i have something strange. I cannot use the lotus notes function AppendDocLink.

The idea is to create a document a database and then create a email and add the document in the body. Then, those who receive the mail can click on the link and see the lotus notes document.
The creation of the document is correct, the email is ok, and sent, but without the DocLink.

Any ideas ?
 
i find, and i give you the tip :

use a Lotus.NotesSession instead of Notes.NotesSession !! You have to initialize the session, and modify a little the sourcecode, but this is the only way i find !!

i thank you again (if u read it ??) because you showed me the way !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top