Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
VFP, Outlook and Redemption
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement