By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,573 Members | 1,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,573 IT Pros & Developers. It's quick & easy.

Outlook Redemption, Again

P: n/a
Hi

Does anyone have a vb.net example of how to use redemption to send mail
through outlook?

Many Thanks

Regards
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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/de...asassembly.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("x@x.x")

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" <jo**@nospam.infovis.co.uk> schrieb im Newsbeitrag
news:ej**************@TK2MSFTNGP09.phx.gbl...
Hi

Does anyone have a vb.net example of how to use redemption to send mail
through outlook?

Many Thanks

Regards

Nov 20 '05 #2

P: n/a
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("in**@infovis.co.uk")
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" <fl***@x4u.de> wrote in message
news:O%****************@TK2MSFTNGP11.phx.gbl...
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/de...asassembly.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("x@x.x")

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" <jo**@nospam.infovis.co.uk> schrieb im Newsbeitrag
news:ej**************@TK2MSFTNGP09.phx.gbl...
Hi

Does anyone have a vb.net example of how to use redemption to send mail
through outlook?

Many Thanks

Regards


Nov 20 '05 #3

P: n/a
Hi,

1 st, if you using the redemtion.dll -> it's a com dll.
you can use com dll's in .net directly, but you have you release the objects
manually.
in c# it's like System.Interop.Marshal.ReleaseComObject(object)

if you generate a WrapperDll, you don't have to deal with unmanaged code.

2.

Maybe you using the wrong credentials.
objNS.Logon("Outlook", "Password Here", False, False)

I get no error, but i noticed, that the email is in my drafts folder.

--
regards,
Helmut Obertanner
DATALOG Software AG
http://www.datalog.de
[obertanner at datalog dot de]
"John" <jo**@nospam.infovis.co.uk> schrieb im Newsbeitrag
news:OS**************@TK2MSFTNGP11.phx.gbl...
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("in**@infovis.co.uk")
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" <fl***@x4u.de> wrote in message
news:O%****************@TK2MSFTNGP11.phx.gbl...
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/de...asassembly.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("x@x.x")

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" <jo**@nospam.infovis.co.uk> schrieb im Newsbeitrag
news:ej**************@TK2MSFTNGP09.phx.gbl...
Hi

Does anyone have a vb.net example of how to use redemption to send mail through outlook?

Many Thanks

Regards



Nov 20 '05 #4

P: n/a
Hi Helmut

Not sure where to go from here. Marshalling isn't my strong point. :)

My full project, dlls and all, is in the email. It was too large to post
here. Would appreciate if you can pin point the problem.

Thanks

Regards

"Helmut Obertanner" <fl***@nospam.x4u.de> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
Hi,

1 st, if you using the redemtion.dll -> it's a com dll.
you can use com dll's in .net directly, but you have you release the objects manually.
in c# it's like System.Interop.Marshal.ReleaseComObject(object)

if you generate a WrapperDll, you don't have to deal with unmanaged code.

2.

Maybe you using the wrong credentials.
objNS.Logon("Outlook", "Password Here", False, False)

I get no error, but i noticed, that the email is in my drafts folder.

--
regards,
Helmut Obertanner
DATALOG Software AG
http://www.datalog.de
[obertanner at datalog dot de]
"John" <jo**@nospam.infovis.co.uk> schrieb im Newsbeitrag
news:OS**************@TK2MSFTNGP11.phx.gbl...
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("in**@infovis.co.uk")
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" <fl***@x4u.de> wrote in message
news:O%****************@TK2MSFTNGP11.phx.gbl...
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/de...asassembly.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("x@x.x")

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" <jo**@nospam.infovis.co.uk> schrieb im Newsbeitrag
news:ej**************@TK2MSFTNGP09.phx.gbl...
> Hi
>
> Does anyone have a vb.net example of how to use redemption to send mail > through outlook?
>
> Many Thanks
>
> Regards
>
>



Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.