Redemption Send EMail fails

Status
Not open for further replies.
P

Peter Hibbs

I am using MS Access 2003 to send an email via Outlook 2003 using

Redemption to prevent the security messages on Windows XP. The basic

(cut down) code is shown below :-

Dim SafeItem, oItem

Dim Application As Outlook.Application

Set Application = CreateObject("Outlook.Application")

Set SafeItem = CreateObject("Redemption.SafeMailItem") Set

oItem = Application.CreateItem(0) SafeItem.Item = oItem

SafeItem.Subject = vSubject

SafeItem.To = vRecipients

SafeItem.Body = vBody

SafeItem.Send

The string variables vSubject, vRecipients and vBody obviously holds

the relevant text. I have also omitted some error checking code in the

interests of clarity.

The code is part of a MS Access application and works perfectly when

Outlook is running at the same time. If, however, Outlook is NOT

running the code fails at the SafeItem.Send command with an error

that just says 'The server threw an exception' and Outlook does not

close down properly, I have to forcibly close it with the Windows Task

Manager.

The Redemption.dll file is located in the C:\WINDOWS\System32 folder

and has been registered with RegSvr32.exe. A reference to the .dll

file has been enabled in Access.

Is there any way I can run this code without having to run Outlook

first?

Peter Hibbs.
 
You need to log in first:

Set Application = CreateObject("Outlook.Application")

set NS = Application.GetNamespace("MAPI")

NS.Logon

Set SafeItem = CreateObject("Redemption.SafeMailItem") Set

oItem = Application.CreateItem(0) SafeItem.Item = oItem

SafeItem.Subject = vSubject

SafeItem.To = vRecipients

SafeItem.Body = vBody

SafeItem.Send

Dmitry Streblechenko (MVP)

-

"Peter Hibbs" <peter.hibbs@btinternet.com.NO_SPAM> wrote in message

news:g1kd059kdqsdufuplod3qnbtvken3703md@4ax.com...
> I am using MS Access 2003 to send an email via Outlook 2003 using
> Redemption to prevent the security messages on Windows XP. The basic
> (cut down) code is shown below :-

> Dim SafeItem, oItem
> Dim Application As Outlook.Application

> Set Application = CreateObject("Outlook.Application")
> Set SafeItem = CreateObject("Redemption.SafeMailItem") Set
> oItem = Application.CreateItem(0) SafeItem.Item = oItem
> SafeItem.Subject = vSubject
> SafeItem.To = vRecipients
> SafeItem.Body = vBody

> SafeItem.Send

> The string variables vSubject, vRecipients and vBody obviously holds
> the relevant text. I have also omitted some error checking code in the
> interests of clarity.

> The code is part of a MS Access application and works perfectly when
> Outlook is running at the same time. If, however, Outlook is NOT
> running the code fails at the SafeItem.Send command with an error
> that just says 'The server threw an exception' and Outlook does not
> close down properly, I have to forcibly close it with the Windows Task
> Manager.

> The Redemption.dll file is located in the C:\WINDOWS\System32 folder
> and has been registered with RegSvr32.exe. A reference to the .dll
> file has been enabled in Access.

> Is there any way I can run this code without having to run Outlook
> first?

> Peter Hibbs.
 
Dmitry,

Thank you. That works now although I had to declare NS as a Variant

first -

Dim NS

Is that correct or should it be declared as some other object type. I

notice also that when I open Outlook the sent email also appears in

the Drafts folder and disappears when I next check for emails. Is this

OK (I remember reading something about this on your Web site, I will

investigate further).

Anyway, thanks again for your help.

Peter Hibbs.

On Sun, 10 May 2009 14:24:44 -0700, "Dmitry Streblechenko"

<dmitry@dimastr.com> wrote:


> You need to log in first:

> Set Application = CreateObject("Outlook.Application")

> set NS = Application.GetNamespace("MAPI")
> NS.Logon

> Set SafeItem = CreateObject("Redemption.SafeMailItem") Set
> oItem = Application.CreateItem(0) SafeItem.Item = oItem
> SafeItem.Subject = vSubject
> SafeItem.To = vRecipients
> SafeItem.Body = vBody

> SafeItem.Send
 
Either a generic Object or Outlook.Namespace woudl do.

Message submitted directly from teh Drafts folder is perfectly normal - a

message can be send from any folder, Outbox is simply an eye candy.

Redemption does nto move the message to the Outbox when you call Send of

purpose since that can create a ghost message. You can explicitly move the

message first before using Redemption:

Set Application = CreateObject("Outlook.Application")

set NS = Application.GetNamespace("MAPI")

NS.Logon

Set SafeItem = CreateObject("Redemption.SafeMailItem")

Set oItem = Application.CreateItem(0)

set oItem = oItem.Move(NS.GetDefaultFolder(6)) 'Outbox

SafeItem.Item = oItem

SafeItem.Subject = vSubject

SafeItem.To = vRecipients

SafeItem.Body = vBody

SafeItem.Send

Dmitry Streblechenko (MVP)

-

"Peter Hibbs" <peter.hibbs@btinternet.com.NO_SPAM> wrote in message

news:6cje05lb9tojqmkq07uf53j6u9up2749et@4ax.com...
> Dmitry,

> Thank you. That works now although I had to declare NS as a Variant
> first -

> Dim NS

> Is that correct or should it be declared as some other object type. I
> notice also that when I open Outlook the sent email also appears in
> the Drafts folder and disappears when I next check for emails. Is this
> OK (I remember reading something about this on your Web site, I will
> investigate further).

> Anyway, thanks again for your help.

> Peter Hibbs.

> On Sun, 10 May 2009 14:24:44 -0700, "Dmitry Streblechenko"
> <dmitry@dimastr.com> wrote:
>
> >You need to log in first:
>

>>Set Application = CreateObject("Outlook.Application")
>

>>set NS = Application.GetNamespace("MAPI")
> >NS.Logon
>

>>Set SafeItem = CreateObject("Redemption.SafeMailItem") Set
> >oItem = Application.CreateItem(0) SafeItem.Item = oItem
> > SafeItem.Subject = vSubject
> > SafeItem.To = vRecipients
> > SafeItem.Body = vBody
>

>> SafeItem.Send
 
Dmitry,

Thanks very much, will try that.

Peter Hibbs.

On Mon, 11 May 2009 10:39:29 -0700, "Dmitry Streblechenko"

<dmitry@dimastr.com> wrote:


> Either a generic Object or Outlook.Namespace woudl do.
> Message submitted directly from teh Drafts folder is perfectly normal - a
> message can be send from any folder, Outbox is simply an eye candy.
> Redemption does nto move the message to the Outbox when you call Send of
> purpose since that can create a ghost message. You can explicitly move the
> message first before using Redemption:

> Set Application = CreateObject("Outlook.Application")
> set NS = Application.GetNamespace("MAPI")
> NS.Logon
> Set SafeItem = CreateObject("Redemption.SafeMailItem")
> Set oItem = Application.CreateItem(0)

> set oItem = oItem.Move(NS.GetDefaultFolder(6)) 'Outbox

> SafeItem.Item = oItem
> SafeItem.Subject = vSubject
> SafeItem.To = vRecipients
> SafeItem.Body = vBody

> SafeItem.Send
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Redemption Send EMail Outlook VBA and Custom Forms 10
D Auto Remove [EXTERNAL] from Subject + ConversationTopic (WITHOUT Redemption plug-in) Outlook VBA and Custom Forms 0
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
N Redemption VBA basics...something's missing Using Outlook 0
D Redemption? Need rapid pull of Outlook Contacts, email + notes for VBA Using Outlook 1
J 64-bit version of Redemption? Outlook VBA and Custom Forms 2
E Redemption access AppointmentItem Label from outlook Outlook VBA and Custom Forms 6
E Redemption MAPI access(c#) Outlook VBA and Custom Forms 4
W Redemption::RDOMail.PrintOut() / DoAction(maPrint) not working Outlook VBA and Custom Forms 1
B Use Redemption to get sender's email address Outlook VBA and Custom Forms 3
M EMail1Address and EMail1AddressType strangeness using Redemption Outlook VBA and Custom Forms 2
A Creating Redemption.MAPIUtils failed with Windows 7 x64 Outlook VBA and Custom Forms 5
D href tags does not result in the full url with Redemption Outlook VBA and Custom Forms 4
E Redemption Foldes.Add doesn't work Outlook VBA and Custom Forms 3
E Redemption Foldes.Add doesn't work Outlook VBA and Custom Forms 3
N Redemption.RDOSession logon() stops emails sending-they stay in Ou Outlook VBA and Custom Forms 3
E Should I switch to redemption Outlook VBA and Custom Forms 11
E Should I switch to redemption Outlook VBA and Custom Forms 11
C Redemption - Rules for outlook Outlook VBA and Custom Forms 1
G Error in Outlook Object Model with redemption and google apps prem Outlook VBA and Custom Forms 3
S redemption reference Outlook VBA and Custom Forms 1
T Configure mailbox OutofOffice with Redemption Outlook Outlook VBA and Custom Forms 1
D redemption dll not registering in windows vista Outlook VBA and Custom Forms 3
Y Redemption MessageItem SaveAs problem Outlook VBA and Custom Forms 8
R Newbie Redemption ISafeMailItemPtr question Outlook VBA and Custom Forms 6
Q GAL.ResolveName issue with REDEMPTION Outlook VBA and Custom Forms 5
Q REDEMPTION HANGING during LOGON Outlook VBA and Custom Forms 2
P Redemption not working on OL2007 Outlook VBA and Custom Forms 2
S delete appointmentitem permanently using redemption Outlook VBA and Custom Forms 2
D redemption - foldercreate event + delegate user Outlook VBA and Custom Forms 8
C Assign To and CC list while using Redemption.dll library Outlook VBA and Custom Forms 10
U Re: Read fields with Redemption Outlook VBA and Custom Forms 1
V redemption MAPIUtils Outlook VBA and Custom Forms 3
R How to use VB .Net to send emails? Outlook VBA and Custom Forms 0
J Outlook VBA to send from Non-default Account & Data Files Outlook VBA and Custom Forms 3
C Synchronization and taking forever to send Using Outlook 2
D Send on behalf of does not store the base mailbox Using Outlook 0
R Outlook 365 VBA AUTO SEND WITH DELAY FOR EACH EMAIL Outlook VBA and Custom Forms 0
S Outlook 2002- "Send" button has disappeared. Help please. Using Outlook 1
TomHuckstep Remove Send/Receive All Folders (IMAP/POP) button from Outlook 365 Ribbon Using Outlook 2
J Macro to send email as alias Outlook VBA and Custom Forms 0
F Add a category before "Send an Email When You Add an Appointment to Your Calendar" Outlook VBA and Custom Forms 0
W Outlook 365 I am getting the "Either there is no default mail client" error when I try to send an email on excel Office 365 Using Outlook 1
T Outlook 2010 recipient no longer shows in 'Send To' Using Outlook 0
Witzker Outlook 2019 Macro to send an Email Template from User Defined Contact Form Outlook VBA and Custom Forms 0
Geldner Tweak Junk Email Reporting tool to default to particular email on send? Using Outlook 3
Geldner Send / Receive a particular group via macro or single keypress Using Outlook 1
E Outlook - Macro - send list of Tasks which are not finished Outlook VBA and Custom Forms 3
L How to avoid issues with "Send on Behalf" Using Outlook 3
M Outlook 365 refuses to send email Using Outlook 0

Similar threads

Back
Top