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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Redemption help 1

Status
Not open for further replies.

wxperson

Programmer
Feb 5, 2004
14
US
HI..

First. I am new at this outlook programming stuff.

I have gotten the following sample send code working on my test PC using outlook redemption.

I do have a few questions however.

1. How can I now attach files to the email message? For example if I want to attach file c:\temp\ex.gif and also c:\temp\ex2.gif ... what would the code change be?

2. How can I specify CC and or BCC recipients.?

Thanks, for any help.

George

***************************************

Dim application
Dim SafeItem, oItem
Set application = CreateObject("Outlook.Application")
Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem
Set oItem = application.CreateItem(0) 'Create a new message
SafeItem.Item = oItem 'set Item property
SafeItem.Recipients.Add "test2@pcwp.com"
SafeItem.Recipients.Add "test@yahoo.com"
SafeItem.Recipients.ResolveAll
SafeItem.Subject = "Testing Redemption subject"
SafeItem.Body = "Test of body of message."
SafeItem.Send

Set oItem = Nothing
Set SafeItem = Nothing
Set application = Nothing

 
Post a question in the newsgroup microsoft.public.outlook.program_addins.

Dimitry Streblechenko (author of Redemption) hangs out there and will answer any questions.

Paul Bent
Northwind IT Systems
 
wxperson, did you ever find coding for that? I am very new to all of this. I have downloaded redemption but Access seems to not recognize it when I call on the objects. Maybe I have not properly installed it. Is there something esle I need to do?

Also, what's the standard coding for sending a message through outlook with redemption?
 
This stuff is confusing to me but I got some code to work.. Just don’t ask me to explain it J Dmitry (redemption.dll author) is very good at support.

Here is the code I use.. I had to cut/paste from VB and skipped some code that does to apply to you. I also change the recipient address and made up a test attachement.. you get the idea. The redemption logic should be good . If you have problems, check with Dmitry.

George.



'Used to create outlook session (does not open outlook on desktop)

Set ol = CreateObject("Outlook.Application")

' redemption sigon

' Return a reference to the MAPI layer

Set ns = ol.GetNamespace("MAPI")

ns.Logon 'Added for Redemption

'Create a new mail message item

Set newMail = ol.CreateItem(0)

Set SafeMail = CreateObject("Redemption.SafeMailItem") '

SafeMail.Item = newMail 'Added for Redemption

With SafeMail

'Add the subject of the mail message

.Subject = mapisubject

'Create some body text

.Body = mapitextbody

‘ repeat this statement for each recipient

With .Recipients.Add(“toperson”)

.Type = 1 ‘ type 2 is CC and type 3 is BCC

End With

‘ to add an attachement file

With .Attachments.Add(“c:\temp\test.gif”)

End with



SafeMail.Recipients.ResolveAll



SafeMail.Send



' to force a send I either open outlook and send or if it is already open, I just force a send/receive

bmustclose = False

If ol.Explorers.Count = 0 Then

bmustclose = True

Set inbox = ns.GetDefaultFolder(6)

inbox.Display

End If

DoEvents

Set explorer = ol.ActiveExplorer

Set btn = explorer.CommandBars.FindControl(1, 5488)

btn.Execute

' need close delay

If bmustclose Then

Call pauseit(20) ' XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx how many seconds is right

explorer.Close

ol.Quit

End If

'Release memory

Set ol = Nothing

Set ns = Nothing

Set newMail = Nothing

Set btn = Nothing

Set utils = Nothing

Set inbox = Nothing

Set explorer = Nothing



 
Since this thread has brought up Redemption, just thought I'd say I've been using it on a couple of projects since it was first brought to my notice by PaulBent some time last year (fx: Keyword Search), ah - in June of last year. And I think it's pretty damn good. Just thought I'd share that with you all.

Oh, and time to give Paul the star I neglected to award him with in June..
 
Good day,

I downloaded the version 3.3 of redemption.
And followed the code above. The Subject is not a property of the SafeMailItem object but is on the MailItem object.

Any help will be appreciated.

AUXilliary COMmunication 1
 
Sorry its MessageItem not MailItem.

AUXilliary COMmunication 1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top