On Wed, Aug 21, 2019 at 12:22 AM MB Software Solutions, LLC < mbsoftwaresolutions@mbsoftwaresolutions.com> wrote:
VFP9SP2 app
Customer uses Outlook and wants the app to generate an email to a given email address from the app AND attach certain documents to it. Customer will preview it and then manually hit "Send" on their own.
Despite its advanced age (16!) this paper still has a few good pointers in it:
https://www.tedroche.com/Present/2003/OutlookAutomation.html
"However, just because you can do something doesn't mean that you should. " made me laugh.
The canonical reference is Office Automation with Visual FoxPro by Tamar E. Granor and Della Martin, edited by yours truly, and more info can be found at:
http://hentzenwerke.com/catalog/autofox.htm
Note that there are sample chapters and downloads available. The site says "Out of Print" but I think the ebook may still be order-able.
Bear in mind that MSFT regularly changes and breaks their APIs, or the mechanism to access the APIs, since skript kiddies regularly take over Outlook and use it to send spam and perpetrate identity theft. Just in the last month's patches, they broke portions of VB6, VBA and VBScript. I shipped a number of apps with Office Automation back in the day, and between Office object model changes and security enhancements required some major rewriting, sometimes sprung on us by surprise. It was a learning experience in how Microsoft supports developers of their products.
Rather than tightly coupling your VFP app with this week's version of Outlook, you might consider how an arm's length relationship could work out better for all involved. You could use WestWind Client Tools, BLAT, or command-line mail tools [1] to draft the message and send it to the customer, who could review it and forward it to the client, with the downside they would need to specify the forwarding address, or you could write a .NET app integrated into Outlook that could read a queue written into a database table by FoxPro and do the automation and processing in .NET.
And remember, kids, MAPI Bad! SMTP Good. Just Say No. We Can Eliminate It In Our Lifetimes.
Good luck!
[1] I also wrote a white paper "Email Without Outlook" for this very reason: https://www.tedroche.com/Present/2002/emailwooutlook.html