locked
Sending email via Lotus notes

    問題

  •  

    Hi,

    I'm trying to send email via Lotus Notes.

    This worked before I updated visual studio from 2003 to 2005. Now I get the following error message: "Attempted to read or write protected memory. This is often an indication that the memory is corrupt."

    I understand that the .net Framework 2.0 has much stricter rules concerning untrusted components and I think the error comes from that, but I have no idea how to give the component a trusted status. I have a reference to Interop.Domino.

    Below is my code:

    Dim domSession As New NotesSession
    Dim domNotesDBMailFile As NotesDatabase
    Dim domNotesDocumentMemo As NotesDocument
    Dim domNotesRichText As NotesRichTextItem
    Dim strAttachment As String
    Dim Username As String
    Dim MsgResult As MsgBoxResult

    Username = Principal.WindowsIdentity.GetCurrent.Name

    Try

    domSession.Initialize(txtPassword.text) 'Prompts user for Lotus Notes Password

    domNotesDBMailFile = domSession.GetDatabase("", "names.nsf") 'This is where the error occurs

    domNotesDocumentMemo = domNotesDBMailFile.CreateDocument

    Call domNotesDocumentMemo.AppendItemValue("Form", "Memo")

    Call domNotesDocumentMemo.AppendItemValue("SendTo", domSession.CommonUserName)

    Call domNotesDocumentMemo.AppendItemValue("CopyTo", thisperson@thisplace.com)

    Call domNotesDocumentMemo.AppendItemValue("Subject", "Error - " & Username)

    domNotesRichText = domNotesDocumentMemo.CreateRichTextItem("Body")

    strAttachment = "C:\VBNet Projects\NetQT2\NetQT1\Data\ErrorLog.txt"

    domNotesRichText.AppendText("NetQT error, sent " & Today.Date & Microsoft.VisualBasic.ControlChars.CrLf)

    Call domNotesRichText.EmbedObject(EMBED_TYPE.EMBED_ATTACHMENT, "", strAttachment, "")

     domNotesDocumentMemo.Send(False)

    MsgResult = MsgBox("The mail has been sent", MsgBoxStyle.OkOnly)

    If MsgResult = MsgBoxResult.Ok Then

    Me.Close()

    End If

    Catch ex As exception

    MsgBox(
    "Email could not be sent! " & Err.Description)

    End Try

    Thanks for any help,

    Chris

    2007年1月29日 下午 01:15

解答

  • What makes you think that it is .net problem?
    It is possible that there is a bug in lotus API that is exposed because of the .net upgrade.
    In either case you need to talk to Lotus API folks first. This error means their P/Invoke could be faulty

    2007年1月30日 下午 04:26
    版主

所有回覆

  • This looks like an API that lotus provided to you. This is not the system.net mail api you are using.
    Please contact the Lotus Notes support

    2007年1月29日 下午 05:59
    版主

  • Hi,

    Thanks for your reply. I don't believe this is a Lotus notes problem. Like I said in my message I could send mail with
    this API before I updated to the .net Framwork 2.0. I think the new security levels that came with 2.0 are causing the error
    due to the interop.domino being an untrusted component.

    I need to know how to tell my application, that it is a trusted compoment.

    Best Regards

    Chris

    2007年1月30日 上午 11:33
  • What makes you think that it is .net problem?
    It is possible that there is a bug in lotus API that is exposed because of the .net upgrade.
    In either case you need to talk to Lotus API folks first. This error means their P/Invoke could be faulty

    2007年1月30日 下午 04:26
    版主
  • domNotesDBMailFile = domSession.GetDatabase("", "names.nsf") 'This is where the error occurs

    Try this... domNotesDBMailFile = domSession.GetDatabase("", "C:\lotus\notes\data\names.nsf")

    or the path wehre her notes is instaled.

    2007年2月13日 下午 01:16
  • You have to set the Lotes Notes client Server Name ...

     also you have to set the boolean option as third option ....

     

    domNotesDBMailFile = domSession.GetDatabase(ServerName, "names.nsf",False)'where ServerName is variable contains the LA client Server Name....

     

    2007年5月21日 上午 11:24