PDA

Click to See Complete Forum and Search --> : How to Send Email - Lotus Notes Automation Classes using Visual Basic?


tms_92
Aug 9th, 2000, 07:12 PM
Can anyone please tell me how to send Email of Lotus Notes 4.5 using Visual Basic.Lotus Notes provides an Automation class for this purpose.But I am unable to create an Object of that class.
Please Help me.

Mage33
Aug 9th, 2000, 07:17 PM
Are you asking how to send an e-mail from VBScript, or how to send the Lotus Notes Program to someone with VBScript, or how to use Lotus Notes Program to send someone an e-mail?

tms_92
Aug 9th, 2000, 07:33 PM
I am Having VB6 and Lotus Notes Notes installed in My PC. I can directly send Email using Lotus Notes.But I want to send Email through VB6 codes using Lotus Notes Automation Classes.
Lotus Notes Provides notes32.tlb file for this purpose.It has many classes inside ,properties and methods
which can be used.But to access all this I need to create an Object of that Class.But I am getting an error like Activex Component cant't Create Object. and program stops executing at this line
Set s = CreateObject("lotus.NOTESSESSION")
Please helpme.

An Example of the code which I have used for getting the number of documents created before 1/1/99.


Sub Macro1()
Dim s As lotus.NOTESSESSION
Dim db As NOTESDATABASE
Dim vw As NOTESVIEW
Dim doc As NOTESDOCUMENT
Dim createtime As Date
Dim doccount As Integer
Set s = CreateObject("lotus.NOTESSESSION")
Set db = s.CURRENTDATABASE
Set vw = db.GETVIEW("Myview")
Set doc = vw.GETFIRSTDOCUMENT
Do Until doc Is Nothing
createtime = doc.CREATED
If (createtime > #1/1/99#) Then
doccount = docount + 1
End If
Set doc = vw.GETNEXTDOCUMENT(doc)
Loop
MsgBox (CStr(doccount) + "documents were created before 1/1/99.")

End Sub

Mage33
Aug 9th, 2000, 07:38 PM
Aah, well, I can't help you there but I can give you a short little function which will let you send e-mail from your address if you want:

Function MailThis(strSubject, strBody)

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = sender name
Mailer.FromAddress= sender address
Mailer.RemoteHost = "Mail sever"
Mailer.AddRecipient "To's Name","To's Address"
Mailer.AddCC "CC's Name","CC's Address"
Mailer.Subject = strSubject
Mailer.BodyText = strBody
End Function

I hope that helps!

darrylds
Sep 1st, 2000, 11:35 PM
Before you can use Lotus Notes back end classes you must do a NotesSession.Initialize to start the connection between VB and Lotus Notes.

Darryl