Modify Code Using Outlook Redemption to bypass security prompts

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

D. Lee was kind enough to provide the original code that I adapted to my
environment which executes perfectly (shown below).

I am trying modify the code, as suggested, in order to bypass the Outlook
security prompts using Outlook Redemption in order to fully automate the rule
that uses the script. Due to my lack of VB programing skills, my attempts
have failed.

Can anyone help?

Sub SaturnFirstResponse(Item As Outlook.MailItem)
Dim objRespond As Outlook.MailItem, _
objTemplate As Outlook.MailItem
Set objRespond = Item.Reply

'Change the template name and path on the following line
Set objTemplate = Application.CreateItemFromTemplate("C:\Documents and
Settings\greenemi.HARRISAUTO\application
data\Microsoft\Templates\OneSourceSalesSaturnFirstResponse.oft")

objTemplate.Recipients.Add objRespond.Recipients.Item(1).Address
objTemplate.Recipients.ResolveAll
objTemplate.Send

Set objRespond = Nothing
Set objTemplate = Nothing

End Sub
 
Off the top of my head:

Sub SaturnFirstResponse(Item As Outlook.MailItem)
Dim objRespond As Outlook.MailItem, _
objTemplate As Outlook.MailItem

'Change the template name and path on the following line
Set objTemplate = Application.CreateItemFromTemplate("C:\Documents and Settings\greenemi.HARRISAUTO\application data\Microsoft\Templates\OneSourceSalesSaturnFirstResponse.oft")

objTemplate.Save

set sTemplate = CreateObject("Redemption.SafeMailItem")
sTemplate.Item = objTemplate
set sItem= CreateObject("Redemption.SafeMailItem")
sItem.Item = Item

sTemplate.Recipients.Add sItem.SenderEmailAddress
sTemplate.Recipients.ResolveAll
sTemplate.Send

Set sTemplate = Nothing
Set objTemplate = Nothing

End Sub


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Thanks! Your code ran without a security prompt. However, the reply is sent
to the **Sender's** email address. I am trying to reply to the sender's
**Reply-To** email address which is a different email address. None of my
attempts at a fix have worked. Can you suggest something I can try?
 
You can check if there is an entry in the ReplyRecipients collection. If
not, use SenderEmailAddress

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I tried to execute this code...but gernerated a "user defined type not
defined" error.
Is there something obvious I'm doing wrong to get this result ?
 
Which line?
I did not declare the variables for the brevity reasons:

Dim sTemplate As Object
Dim sItem As Object

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"user defined type not defined" <user defined type not
(e-mail address removed)> wrote in message
 
Back
Top