Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook/redemption not sending emails
Message
From
09/11/2002 12:18:55
Alan Harris-Reid
Baseline Data Services
Devon, United Kingdom
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Outlook/redemption not sending emails
Miscellaneous
Thread ID:
00720652
Message ID:
00720652
Views:
47
This is a modified version of previous message, but I haven't found a suitable solution to my problem yet.

Using Visual Foxpro 7 and Outlook XP (with XP pro), I am creating email messages and sending them to the Outbox, but they are not actually being sent unless I go to the folder and send them manually. Is there any way to ensure that the emails are sent automatically? The email server is definitely running in the background. If I close and reopen Outlook manually, the emails in the outbox are sent immediately (I guess because the 'Send/receive upon connection' checkbox is ticked).

The code is as follows...

* ---------------------------------------------------

LOCAL oOutLook, oMailItem, oSafeMailItem, oNameSpace

oOutlook = CREATEOBJECT("Outlook.Application")
oMailItem = oOutlook.CreateItem(0)

* The following lines are only required if addressing outlook folders.
* oNameSpace = Outlook.GetNameSpace('MAPI')
* oNameSpace.logon

* Redemption is used to by pass MSFT security messages
oSafeMailItem = CREATEOBJECT("Redemption.SafeMailItem")
oSafeMailItem.Item = oMailItem

WITH oSafeMailItem
.Recipients.Add("someone@somewhere.com")
.Recipients.ResolveAll()

.Subject = "This is the subject"

* NOTE: if sending HTML string, string must be stored to both
* .body AND .HTMLbody properties. (As recommended by Redemption, author 31/10/02)
.body = lcHTMLString
.HTMLbody = lcHTMLString

.Send()
ENDWITH

* ---------------------------------------------

As a workaround, I thought of programmatically closing Outlook, then opening it again to make it appear as if it had been opened manually. That didn't work either. The additional code was as follows...

STORE .NULL. TO oOutLook, oMailItem, oSafeItem
RELEASE oOutLook,oSafeItem, oMailItem

* Reopen Outlook
oOutLook = CREATEOBJECT('Outlook.application')

Any help would be appreciated. This problem is really bugging me (pardon the pun).

Alan Harris-Reid
Next
Reply
Map
View

Click here to load this message in the networking platform