Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Redemption Object to send email

Status
Not open for further replies.

kezzab

Programmer
Nov 9, 2005
14
GB
I am trying to send an automatic email to bypass the outlook security model by using the Redemption objects which I have dowloaded from the web.

However the code I have doesn't seem to work, I'm not sure if this is missing some important code or wheter the syntax isin't relevant for a .Net project. The code is as follows:-

Dim SafeItem, oItem
SafeItem = CreateObject("Redemption.SafeMailItem") '
oItem = Application.CreateItem(0)
SafeItem.Item = oItem
SafeItem.Recipients.Add("name@domain.com")
SafeItem.Recipients.ResolveAll()
SafeItem.Subject = "Testing Redemption"
SafeItem.Send()

It is the Application.CreateItem(0) which is causing me problems, is this because this code is designed for VBA?

Any advice would be appreciated.
 
I used Redemption once in a project and I wrote the following code which works perfect in VB .NET:

Code:
Private Sub SendNotification()
  Dim Application As New Outlook.Application
  Dim sNamespace As Outlook.NameSpace = Application.GetNamespace("MAPI")
  sNamespace.Logon()

  Dim SafeItem As New Redemption.SafeMailItem
  Dim oItem As Outlook.MailItem

  oItem = Application.CreateItem(0)
  oItem.Importance = OlImportance.olImportanceHigh
  SafeItem.Item = oItem
  SafeItem.Recipients.Add("xxx@xxxxxxx.com")
  SafeItem.Recipients.ResolveAll()
  SafeItem.Subject = "IT Security Administration Alert"
  SafeItem.BodyFormat = OlBodyFormat.olFormatPlain
  SafeItem.Body = "A failed login to IT Security Administration has been logged." 
  '<cut>
  SafeItem.Send()
 
 sNamespace.Logoff()

  oItem = Nothing
  SafeItem = Nothing
  Application = Nothing
  sNamespace = Nothing
End Sub

I hope you can use it.

Regards, Ruffnekk
---
Is it my imagination or do buffalo wings taste just like chicken?
 
Thanks Ruffnekk, but using this still gives me the same error whcih leads me to believe i'm missing something within my project, it falls ove on the line

SafeItem.Recipients.Add("xxx@xxxxxxx.com") - (With my correct email address) stating:-

System.Runtime.InteropServices.COMException: Item.MAPIOBJECT property is not supported: Access is denied

Am i missing a com component, or something else?

Any ideas?

Regards


 
Are you using it in combination with an Exchange server?

Regards, Ruffnekk
---
Is it my imagination or do buffalo wings taste just like chicken?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top