ones81

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



Re: .NET Framework Networking and Communication Sending email via Lotus notes

Durgaprasad Gorti

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






Re: .NET Framework Networking and Communication Sending email via Lotus notes

ones81


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





Re: .NET Framework Networking and Communication Sending email via Lotus notes

Durgaprasad Gorti

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






Re: .NET Framework Networking and Communication Sending email via Lotus notes

Jorge123_

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.





Re: .NET Framework Networking and Communication Sending email via Lotus notes

Ahmed lpo

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....