Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP, Outlook and Redemption
Message
From
30/10/2002 09:42:27
Alan Harris-Reid
Baseline Data Services
Devon, United Kingdom
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
VFP, Outlook and Redemption
Miscellaneous
Thread ID:
00716850
Message ID:
00716850
Views:
51
I am currently sending emails from Visual Foxpro via. Outlook and OLE automation. Because I am using XP I am getting the (in)famous error message "A program is trying to automatically send e-mail on your behalf. Do you want to allow this?..." To get around this I have installed Redemption.

Using the code below, I am no longer getting the nuisance error messages, emails are being sent and received, but they are blank - the subject is there, but no message!

If anyone could point-out where I have gone wrong in the code below I would be grateful.

* -----------------------------------
LOCAL oOutLook, oItem, oSafeItem, oNameSpace

oOutlook = CREATEOBJECT('Outlook.Application') && open outlook
oSafeItem = CREATEOBJECT('Redemption.SafeMailItem') && open redemption

* Do I really need the following 2 lines?
oNameSpace = oOutLook.GetNameSpace('MAPI')
oNameSpace.Logon

SELECT MyTable

SCAN
oItem = oOutlook.createitem(0) && create new mail message
oSafeItem.Item = oItem && create safe item object

WITH oSafeItem
.Recipients.Add("emailaddress")
&& should I use .To="emailaddress" instead?
.Recipients.ResolveAll && only necessary if using Redemption
.subject = "Order Despatch Confirmation"
.HTMLBody = lcHTMLString
.Save()
.Send()
ENDWITH
ENDSCAN
* -------------------------------------

TIA
Alan Harris-Reid
Next
Reply
Map
View

Click here to load this message in the networking platform