0

Please somebody help me. I use Lotus Notes to send email with using vb.net but I got this error when I try to run. I already add references about interop.lotus.dll and interop.Domino.dll but it's still the same error. Please advice..

Line 115:        If dsEmail.Tables(0).Rows.Count > 0 Then
Line 116:            **s.Initialize("abcde!")** 'ERROR in THIS LINE




Protected Sub btnSend_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.ServerClick
    Dim s As New Domino.NotesSession
    Dim db As Domino.NotesDatabase
    Dim doc As Domino.NotesDocument
    Dim mimeEntity As Domino.NotesMIMEEntity
    Dim mimeChild As Domino.NotesMIMEEntity
    Dim header As Domino.NotesMIMEHeader
    Dim stream As Domino.NotesStream
    Dim sendTo As String
    Dim connectionString As String = "Data Source=[hide];User ID=[hide];initial Catalog=[hide];Password=[hide]"
    Dim objConn As New SqlConnection(connectionString)
    objConn.Open()
    Dim dsEmail = New DataSet
    Dim CommTaskA As SqlCommand
    Dim AdapTaskA As SqlDataAdapter
    CommTaskA = New SqlCommand("select EMAILBLASTCCID, rtrim(ltrim(EMAILADDR)) EMAILADDR, SUBJECTEMAIL, EMAILTEMPLATE from [hide] where [MESSAGE_TIME] is NULL", objConn)
    CommTaskA.CommandTimeout = 180
    AdapTaskA = New SqlDataAdapter
    AdapTaskA.SelectCommand = CommTaskA
    AdapTaskA.Fill(dsEmail)
    AdapTaskA.Dispose()
    CommTaskA.Dispose()
    objConn.Close()
    If dsEmail.Tables(0).Rows.Count > 0 Then
        s.Initialize("abcde!")
         db = s.GetDatabase("[hide]", "[hide].nsf", False)
        subjectEmail = dsEmail.Tables(0).Rows(0)(2).ToString
        For x As Integer = 0 To dsEmail.Tables(0).Rows.Count - 1
            doc = db.CreateDocument()
            sendTo = dsEmail.Tables(0).Rows(x)(1).ToString
            doc.ReplaceItemValue("SendTo", dsEmail.Tables(0).Rows(x)(1))
            doc.ReplaceItemValue("Subject", dsEmail.Tables(0).Rows(x)(2))

            mimeEntity = doc.CreateMIMEEntity
            mimeChild = mimeEntity.CreateChildEntity
            header = mimeEntity.GetNthHeader("Content-Type")
            header.SetHeaderVal("multipart/related")

            stream = s.CreateStream
            stream.WriteText("<img src='" & dsEmail.Tables(0).Rows(x)(3) & "'>")

            mimeChild.SetContentFromText(stream, "text/html", Domino.MIME_ENCODING.ENC_NONE)
            stream.Close()

            doc.Send(False)
            objConn.Open()
            CommTaskA = New SqlCommand("update [ZITA].[DEV].[EMAILBLASTCC_test] set [MESSAGE_TIME] ='" & DateTime.Now.ToString & "'  where rtrim(ltrim(EMAILADDR)) = '" & sendTo & "'", objConn)
            CommTaskA.CommandTimeout = 180
            CommTaskA.ExecuteNonQuery()
            CommTaskA.Dispose()
            objConn.Close()
        Next


    End If
End Sub

enter image description here

oiko
  • 11
  • 3
  • we are going to need more code... what is s? – Mych May 18 '16 at 07:09
  • oh ok ok I am sorry this is s Dim s As New Domino.NotesSession Any Advice?? – oiko May 18 '16 at 07:11
  • Based on http://www.ibm.com/support/knowledgecenter/SSVRGU_9.0.0/com.ibm.designer.domino.main.doc/H_EXAMPLES_INITIALIZE_METHOD_SESSION_COM.html the initialise method is passed a password. Please check that the password is correct... if it is we will need to see more code regarding the connection. – Mych May 18 '16 at 07:26
  • Thank you mych for your response but I really sure the password is correct because I already login to IBM lotus notes with this password.. – oiko May 18 '16 at 07:38

2 Answers2

1

Thank you for all your respond.. I found the answer the problem because the user account Lotus Notes and my IIS Manager are different. You must make your Lotus Notes IBM and Application Pool Identity in IIS Manager run with the same account. It works for me. Thank You

oiko
  • 11
  • 3
-1

Make sure the Windows environment variable PATH points to C:\Users\adventina.nababan\AppData\Local\IBM\Notes\Data\ too.

For further instructions on how to do this, please take a look at the question "Adding directory to PATH Environment Variable in Windows".

Community
  • 1
  • 1
jAmEs_
  • 1
  • 1