• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3278
  • Last Modified:

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
0
fmoore0001
Asked:
fmoore0001
2 Solutions
 
alorenzhCommented:
Hello, I have a client who runs a mail exchange 2003 for sending your emails
it tells me that this problem only happens with me. your emails will be queued and reintanta your shipping up to 3 hours. reach the end sent to my mail, but after 50 attempts. are small post. my email is a lotus notes and I happened to anyone else. I have a fireward Junipper and review it and which has no restriction.
the error that customer brand the connection was dropped by the remote host

sgs previously had a 5400, which changed the thinking that this could be the problem but we continue with the same

we reviewed all our dns, telnet've tested and both tests are successful in my business, so I guess the problem is with my client. thinking that he needs some adjustment to their exchange, the glue used to barracuda

could someone help me with this detail
se los agradeceria much because I have almost four months
thanks
0
 
jrbbldrCommented:
The warning message is one of the many 'features' thrust upon you by Micro$oft as the result of an Outlook Update.  It came in one of the Service Packs (probably SP-2).

I have heard that you can change the Outlook Security settings to get rid of it, but I never found out where/how to do it.   Perhaps someone can point out the particulars on how to change Outlook to eliminate the Warning Message.   It would fix your issue for free.

Regardless, long before I was even aware of the possibility of changing Outlook's settings I chose to use a 3rd party tool to get around this annoying issue.
I use Redemption  (http://www.dimastr.com/redemption/).  
It isn't free, but it works well to eliminate the issue totally and the support from the creator Dmitry has been very good.  Additionally through Redemption I have introduced some functionality that I think would have been very difficult to do directly through Outlook.

Another 3rd party tool that you might look into would be ClickYes (http://www.contextmagic.com/express-clickyes/).   It works by stuffing the keyboard buffer to fool Outlook that the YES button has been clicked in the Warning message window.

Good Luck

0
 
fmoore0001Author Commented:
Jrbbidr,

My problem is I have thousands of clients, so either program is no an option, unless I could add them as a DLL to my software.  Anyone else have an idea how to turn off the security from Foxpro or maybe buffer the yes response from Foxpro?

Frank
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
fmoore0001Author Commented:
Another alternative is to use the MAILTO command, but I found no way to make it send automatically.
0
 
fmoore0001Author Commented:
Oh, my.  Now I did the following in Outlook 2007:

I tried running Outlook .exe as a administrator
I set the Programmatic Access Security to: Never warn me about suspicious activity
Tried running my test program.  Would not even try to e-mail this time.  Kept getting errors
Closed that outlook session and restarted my normal outlook session.
The Programmatic Access Security reset to: Warn me about suspicious activity when my antivirus...
Oh, well.
Then I ran my test program one last time.  Now, it sends with no warnings at all!!  I can find NOTHING reset in outlook, and have no idea what the hell I did.
I reboot the computer.  Still lets me send with no problems.

Any ideas from anyone?  What did I do?

Microsoft, oh Microsoft, why dost thou persecute thy programmers!!
0
 
Olaf DoschkeSoftware DeveloperCommented:
Those settings of Outlook are in the registry, see http://office.microsoft.com/en-us/ork2000/HA011524811033.aspx
In OL2007 this should still work the same. In company environments with an Exchange server, these security settings may not work and you need to ask the Exchange adminitrator to configure this centrally for all outlook clients.

Most probably the actions you took as admin created those or very similar registry entries to allow OL automation in general. Disadvantage is, you opened the gate for every program automating outlook email.

And then there is another tool simply programmatically confirming the dialogs warning about automation of outlook, google redemption. and this has the same disadvantage.

On the other side spam mail bots will usually simply provide their own ways of sending mails, not via oulook, but directly by a tcp port and with the smtp protocol, so it's not much of a risc to allow automation of outlook. Then again you take away control over it, if you perforate that security.

I think it really was a good idea of MS to listen to customer wishes to raise security and it's a bad sign, that this has still not become standard knowledge of developers and instead hacks like redemption became popular.

Bye, Olaf.
0
 
fmoore0001Author Commented:
Olaf,

I disagree on the security issue as this "security" has made the Office Automation of Outlook, well, worthless.  As you have said most spam bots take their own way to send e-mails, and Microsoft's security in this case just made a legitimate use of it worthless.  This is not a win for users or programmers.

With that kind of thinking, the current administrations Homeland Security ought been be recuiting from Microsoft's developer pool.

Okay, assume the Office Automation portion of Outlook is now worthless.  Anybody have some alternatives for e-mailing from Foxpro where I can automatic the process, such as confirming to an investor that a payment has been made his account whenever the payment is processed?

Frank
0
 
tusharkanvindeCommented:
If you run Outlook as Administrator, then you will have to run your program as administrator too, otherwise the createobject will fail.

You have most probably saved the "Never warn me about suspicious activity" so there is no warning any longer.
0
 
Olaf DoschkeSoftware DeveloperCommented:
Frank,

I already pointed you towards the solution.

And it's not Microsofts job to a make every  home secure, that spam bots could send mail through. But they go forward and make their #1 mail client a thing, of which the users remains in control.

In in regard to the other security holes, Microsoft just holds back, because they don't want to push anti-virus and firewall manufacturers out of business. They couldn't afford the bad publicity that would make. I'm sure they could do the best protection suite, even if they'd need to buy some patent license. Who else but the manufacurer of an OS can protect it best.

They did a really good job with Vista's security, they did not so well with OneCare and the standard antispyware tool "Windows Defender", but the windows firewall is pretty good usable and as I already said I assume they don't retreat from this area because they lack knowledge.

You're proving to be ignorant, if you still ask for a solution, when you're already given one. Sorry to say that.
If you want an easier way than setting up some registry keys, I can also give you the google search result, here you are: http://www.dimastr.com/redemption/

And ask for a refund and deletion of this question. This is not worth of being put into the EE KB and it's already in there in many sections anyway.

RE DEMP TION. memorize it.

Bye, Olaf.
0
 
Olaf DoschkeSoftware DeveloperCommented:
ps: Let me apologize for the tone, Frank, but not for the core statements. You best try to find the registry keys corresponding to OL2007, if they really differ and solve it that cleaner way.

Bye, Olaf.
0
 
fmoore0001Author Commented:
Olaf,

I was very surprised at the tone, especially when you have been so helpful in the past.  Your answer and solution were insufficent, and not what I was looking for at all.

I have written to the redemption people twice with no response.   I was hoping to hear some other solutions if possible.  You may not know everything on the market.  Thank you.

Frank

 
0
 
Olaf DoschkeSoftware DeveloperCommented:
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.
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("fred.bloggs@bloggsville.com")
    .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 

Open in new window

0
 
fmoore0001Author Commented:
Thanks for all the suggestion, as always.
0
 
andrewbarnettCommented:
you could also try this freeware program out it allows you to selectively allow access to outlook (and bypass security) by specific application.

http://www.mapilab.com/outlook/security/
0
 
HOLLYWUBCommented:
I just did a project where I needed to create a PDF file and email it without the user seeing any interaction in Outlook 2003. This is the link to the library. I have the code the works for sure with his library if anyone wants it, let me know. No security message...

http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,baccc84d-4d91-458b-a839-ad03662dfc34.aspx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now