Question : Using outlook.application in Foxpro

I came across this neat little program for usng Outlook via Foxpro.  It works well, and most of my clients have Outlook anyway, but whenever I run it I get a warning, I assume from Outlook, that some program (mine!!) is accessing Outlook and I have to choose if I allow or cancel the operation.  I want to just send it and forget it.  Any idea how to do this?

And, any idea if other programs like Eudora, etc. can be accessed the same way.  Outlook Express is NOT supposed to work with this:

#DEFINE MAILITEM 0
#DEFINE IMPORTANCELOW 0
#DEFINE IMPORTANCENORMAL 1
#DEFINE IMPORTANCEHIGH 2

oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(MAILITEM)

WITH oEmailItem
   .Recipients.Add("moe@3stooges.com") && uses the Recipients collection
   .Subject = "Automation sample"
   .Importance = IMPORTANCENORMAL
   .Body = "This is easy!"
   .Attachments.Add("c:\mydir\sample.txt") && Note that the fully qualified path and file is required.
   .Send
ENDWITH

RELEASE oEmailItem
RELEASE oOutLookObject

Answer : Using outlook.application in Foxpro

Frank,

again my apaology for my tone.

And besides that, I'm very sure redemption is solving your problem. You will need to rewrite the code a little, if you use redemption, because then you're using redemption objects and redemption is controlling outlook via Extended Mapi: http://www.dimastr.com/redemption/objects.htm

There's a vfp sample code on how to use redemption over there at foxite: http://www.foxite.com/articles/read.aspx?id=73&document=outlook-automation-part-3

Besides that there are even more than the usual 3 ways to send mail from vfp, and this has also already been discussed and pointed to many many times - sigh.

http://fox.wikis.com/wc.dll?Wiki~AutomatedEmail

Bye, Olaf.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
LOCAL loOutlook   AS Outlook.Application
LOCAL loNameSpace AS Outlook.NameSpace 
LOCAL loMailItem  AS Outlook.MailItem
LOCAL loSafeItem  AS Object 

#DEFINE olMailItem   0

loOutlook   = CREATEOBJECT('Outlook.Application')
loNameSpace = loOutlook.GetNamespace("MAPI")
loNameSpace.Logon
loMailItem  = loOutlook.CreateItem( olMailItem )   && This creates the MailItem Object
loSafeItem  = CREATEOBJECT(Redemption.SafeMailItem)

WITH loSafeItem
    .Item    = loMailItem     && This attaches the Mail Object to 
                              && Redemption SafeMailItem Object
    .Recipients.Add("[email protected]")
    .Subject = "Test Email with VFP & Redemption"
    .Body    = "This is the Main Body of the Message"
    .Send   && this does not cause the Security Dialog to be displayed.
ENDWITH 
Random Solutions  
 
programming4us programming4us