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.
 
D

Dmitry Streblechenko

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.
 
P

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
 
D

Dmitry Streblechenko

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
 
P

Peter Hibbs

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
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
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 1
A Change settings Send/receive VBA Outlook VBA and Custom Forms 0
M I cant send emails via Outlook in my W10 PC. Using Outlook 3
K Run a script rule to auto 'send again' on undeliverable emails? Outlook VBA and Custom Forms 1
G Send a greeting message to a contact on birthday Outlook VBA and Custom Forms 5
T Outlook creates a copie of every mail I send Using Outlook.com accounts in Outlook 4
R How to restrict GWSMO sync to Outlook Send/Receive cycles Using Outlook 0
M Outlook, send to > mail recipient - results in plain text email Using Outlook 1
A Unflag Inbox and Flag Inbox with Orange Category After Item is send Outlook VBA and Custom Forms 3
glnz O365 - How to send from acct 2 but showing email name from acct 1 as From - alias? Using Outlook 0
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
PGSystemTester VBA To Change AppointmentItem.BusyStatus From MeetingItem Before Send Using Outlook 0
C Synchronizing subscribed folders causes hanging during send/receive process Using Outlook 2

Similar threads

Top