Dear All,
We are using the following code for sending email in Lotus Notes 4.5 which is very older version.Suddenly the company change it to latest one IBM Notes 9.0.1.The smae code is not working for sending mail. Pls help me to sort out.I am in very bad position for that
Function EmailSendWithLotus(strReportpath As String, strSubject As String)
Dim noSession As Object
Dim noDatabase As Object
Dim noDocument As Object
Dim obAttachment As Object
Dim EmbedObject As Object
Dim stSubject As Variant
Dim vaRecipient As Variant
Dim vaCCRecipient As Variant
Dim vaMsg As Variant
Dim stAttachment As String
Dim vaRecipient1 As String
Dim vaCCRecipient1 As String
Dim strArray() As String
Dim intCount As Integer
On Error Resume Next
Const EMBED_ATTACHMENT As Long = 1454
vaMsg = “Dear Sir,” & vbCrLf
vaMsg = vaMsg & “” & vbCrLf
vaMsg = vaMsg & “Kindly find the attached energy report " & vbCrLf
vaMsg = vaMsg & “” & vbCrLf
vaMsg = vaMsg & " Thanks & Regards” & vbCrLf
vaMsg = vaMsg & “” & vbCrLf
vaMsg = vaMsg & " Unit-4 & 5 EMS System" & vbCrLf
stSubject = strSubject
'Instantiate the Lotus Notes COM’s Objects.
Set noSession = CreateObject(“Notes.NotesSession”)
Set noDatabase = noSession.GETDATABASE(“”, “”)
'If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then
noDatabase.OPENMAIL
End If
If strReportpath = “” Then
Exit Function
End If
stAttachment = strReportpath
'Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
Set obAttachment = noDocument.CreateRichTextItem(stAttachment)
Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, “”, stAttachment)
If gEmailTo = “” Then
Exit Function
End If
'vaRecipient = gEmailTo
vaCCRecipient = gEmailCC
strArray = Split(gEmailTo, ", ")
vaRecipient = strArray
MsgBox vaRecipient
'MsgBox Split(vaRecipient, ", ")
'Add values to the created e-mail main properties.
With noDocument
.Form = “Memo”
.SendTo = vaRecipient
.Subject = stSubject
.Body = vaMsg
.SaveMessageOnSend = True
End With
'Send the e-mail.
With noDocument
.PostedDate = Now()
.Send 0, vaRecipient
End With
'MsgBox “The e-mail has successfully been created and distributed.”, vbInformation
'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
End Function