Hi Helmut
Many thanks for that. I added outlook 10 and redemption.dll references under
COM. Would this not be enough for vs.net to automatically generate interop
dlls?
My code with slight modifications is given below. I am getting the error at
the specified line. Any idea what I am doing wrong?
Thanks
Regards
Imports Outlook
Imports Redemption
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objSafeItem As Redemption.SafeMailItem
Dim objMailItem As Outlook.MailItem
objApp = New Application
objNS = objApp.GetNamespace("MAPI")
objNS.Logon("Outlook", "", False, False)
objMailItem = objApp.CreateItem(OlItemType.olMailItem)
objSafeItem = New SafeMailItem
objSafeItem.Item = objMailItem
objSafeItem.Recipients.Add("(e-mail address removed)")
objMailItem.Subject = "TestMessage"
objSafeItem.Body = "TestMessage"
objSafeItem.Send() ' <=== ERROR HERE:
System.Runtime.InteropServices.COMException (0x80040607): Could not submit
the message - error 0x80040607
objSafeItem = Nothing
objMailItem = Nothing
objNS.Logoff()
objNS = Nothing
objApp = Nothing
End Sub
End Class
Helmut Obertanner said:
Hi,
normal i code in c#, but here is a translation to vb.net:
i created an Interop dll with tlbimp for Redemption
see article:
http://msdn.microsoft.com/library/d.../html/cpconimportingtypelibraryasassembly.asp
Imports Microsoft.Office.Interop.Outlook
Imports RedemptionNet
Class MyApp
Public Shared Sub Main()
Dim objApp As Microsoft.Office.Interop.Outlook.Application
Dim objNS As Microsoft.Office.Interop.Outlook.NameSpace
Dim objSafeItem As RedemptionNet.SafeMailItem
Dim objMailItem As Microsoft.Office.Interop.Outlook.MailItem
objApp = New Application
objNS = objApp.GetNamespace("MAPI")
objNS.Logon("Outlook", "", False, False)
objMailItem = objApp.CreateItem(OlItemType.olMailItem)
objSafeItem = New SafeMailItem
objSafeItem.Item = objMailItem
objSafeItem.Recipients.Add("(e-mail address removed)")
objMailItem.Subject = "TestMessage"
objSafeItem.Body = "TestMessage"
objSafeItem.Send()
objSafeItem = Nothing
objMailItem = Nothing
objNS.Logoff()
objNS = Nothing
objApp = Nothing
End Sub
End Class
--
--
regards,
Helmut Obertanner
DATALOG Software AG
http://www.datalog.de
[obertanner at datalog dot de]
John said:
Hi
Does anyone have a vb.net example of how to use redemption to send mail
through outlook?
Many Thanks
Regards