×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Email automation with OUTLOOKNEW

Email automation with OUTLOOKNEW

Email automation with OUTLOOKNEW

(OP)
I have been using ShellExecute to automate outlook emails from within a FoxPro app. Everything was fine until we upgraded to Windows 11 and had to switch to OutLookNew. Now we gat a message that this feature is not supported.

Any ideas will be greatly appreciated.

Sam

RE: Email automation with OUTLOOKNEW

First of all, please be precise about the error and source of error.

There is an error number 1001 in VFP with the message "Feture is not available" which happens, for example, when you have a line SET STEP ON and run the EXE, not the IDE. That's gone in VFP9, but would still cause this error in VFP8 or older, I think.

ShellExecute never was the best way of creating mails, albeit a simple, executing "mailto:" URLs that can even trigger to bring up gmail.com, see thread184-1829430: Create eMail

ShellExecute is stil present in Windows 11, I wouldn't even look if you told me in Windos 20 whether it is an API function that's gone. It's the same function that is used by Windows Explorer when you double click any file and triggers the start of the application asociated with the file extension. If MS would remove that, there would need to be a drastic change in the overall Windows API world to justify that.

I bet you just have forgotten to remove a SET STEP ON. It would be better to set break points instead.

Chriss

RE: Email automation with OUTLOOKNEW

Also, what exactly do you mean by "OutLookNew"? I know that Outlook mail (and calendar) is now part of Windows, rather than a separate product or part of Office or Microsoft 365. But the way you have phrased your question suggests it is something more than that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Email automation with OUTLOOKNEW

(OP)
This is the code being used. There is no SET STEP. It used to open a "New Email" window and all I had to do was drag the attachment and click "Send".

CODE -->

lcMail = "mailto:"+ email + ;
		'?Subject= '+ emSubject + ;
		'&Body=Dear Customer,%0A%0A' + ;
		'The attached PDF file is your renewal order/reminder for '+ ;
		'Shopping List for the '+emYear +'.' + ;
		'%0A%0AThe quickest and cheapest way to order is online at:      www.shop-up.com' + ;
		'%0A%0AYour timely response will be appreciated.%0A%0AEasy Shopping'

	ShellExecute(0,"open",lcMail,"","",1) 

Now, all I get is multiple Blank windows that eventually partly populates and then a blank window that says:

This action isn't supported yet

The New Outlook for Windows doesn't currently support this action. You can switch back to Classic Outlook for Windows and try again.

Thanks,
Sam

RE: Email automation with OUTLOOKNEW

Well, the first thing to do is to check what action is assigned to the "mailto:" protocol - and to change it if necessary.

You can do that in Settings > Default Programs > Set Associations > Protocols. Scroll down until you see "mailto:". Presumably it is pointing to "New Outlook for Windows" or something similar. If so, click "Change Program" to choose a different program. Ideally, choose the old version of Outlook (what they call "Classic Outlook"; or it might just be labelled "Microsoft Outlook) if you have that installed (or can easily install it). If not, consider installing a third-party email client (such as Thunderbird or Postbox).

The point is that won't matter what email client you use here. ShellExecute() simply calls that client and tells it to open a message composing window. The actual message will be the same regardless, as will the subsequent user action.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Email automation with OUTLOOKNEW

Well, that in short means this new Outlook version is not programmed with MAPI standards. Bad move, Microsoft.

Well, what you can do as you are your own "customer" and just need this machanism to work again, is install any MAPI complient mail client, of which there are a lot.

As already pointed out in the recent thread you can setup Windows to use gmail as standard mail client and will get a mail tab in your standard browser, gmail also supports drag&drop of attachment files. That doesn't even require a software installation. Another very popular MAPI complient mail client is thunderbird, which also is free.

Both gmail and thunderbird can be configured to use your mail address (yes, indeed gmail is not only capable to maintain gmail addresses).

Chriss

RE: Email automation with OUTLOOKNEW

There is an easy way for you to test what Chris and I have both posted above.

Simply create a text file, and type this code into it:

<p><a href="mailto:anyname@example.com">Click here to send email</a></p>

(The actual email address doesn't matter. It is just for testing.)

Save the file with extension HTML.

Next, find the file in the File Explorer and double-click on it. This will open it in your browser. Now click the text where indicated. This should launch the message composing window in the program associated with the mailto: protocol.

If you see the same "This action isn't supported yet" message, then you will know that the problem has nothing to do with VFP or with ShellExecute(). In that case, the solution would be to change to a different email client, as explained above.

If, on the other hand, you get a satisfactory composing window in the new Outlook, then the problem must lie in the other parameters that you specified in the mailto: link, such Subject and Body. I think that is very unlikely, but it would be worth checking.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Email automation with OUTLOOKNEW

You could also just paste the mailto:anyname@example.com URL into the address bar of your browser to see it start the standard mail client of Windows.

Chriss

RE: Email automation with OUTLOOKNEW

(OP)
Thanks everyone.

I will read and digest all the info. Im sure something will work.

Sam

RE: Email automation with OUTLOOKNEW

By teh way, the use of mailto: URLs and ShellExecute is not strictly "automation" in the sense of COM automation, which is done by first creating automation server like you can also build with VFP when you design a class to be olepublic.

So, in short, COM automation would first create an outlook instance with CREATEOBJECT("Outlook.Application"), executing a mailto: URL is just making use of the MAPI meachnism this is triggering to start the mail client defined as Windows standard mail client and creating a new mail item on the standard mail account. It's also automatic, so in that sense automation, sure, but it's not the gold standard COM automation you could use.

According to https://www.accessforever.org/post/the-new-outlook... this version of outlook indeed loses the COM automation available for the standard Outlook Desktop applications. It's instead based on WebView2, like the Edge browser and this article expects there to be a javascript based automation mechanism.

Anyway, when you build a new mail client, and I'm sure MS has reused a lot of the Outlook codebase, no matter if the UI and interface changed, at least mailto: URLS should work, the ShellExecution of mailto: URLs also worked with Outlook Express, if you remember that as the small (and free) brother of the fully fledgbed Office Outlook, mailto: alsop worked with Windows Mail, if you also remember that - and I think that also still is available - as part of the Windows Live / Windows Essential. We've already been through a lot of ups and downs on Microsoft deciding for and against such bundles of software that enable private users to have all the essential functionalities they need without having Office or even an Office susbcription. And indeed the pressure of the free Google suite of docs/sheets/gmail and other such suites like OpenOffice or LibreOffice and more.

I just took a stab at googling Microsoft revenues and see MS makes most money with their cloud computing platform, more than with sales of Windows and Office combined. So this software landscape change seems to me a step to get everything more integrated into the cloud (web) than to the desktop, basing that Office on WebView2 is clearly a step in that direction. We'll likely see a shoft away from COM in more aspects in the coming years.

Still, it shouldn't even affect you with not using COM automation but the mechanism to trigger the standard mail client. That's a loss in quality, to me. They might have their reasons to bury COM, but when you undermine such mechanisms that's putting users into a situation where they need third party software that still supports standards Microsoft even was involved with defining and integrating into Windows and their own software suites, even those free express versions MS also always offered.

Chriss

RE: Email automation with OUTLOOKNEW

Quote:

You could also just paste the mailto:anyname@example.com URL into the address bar of your browser

Yes, of course. I should have thought of that as well.

In fact, you could even simply click on the link as posted in this thread. Or on any other email address on any website. (Remember, clicking a mailto: link doesn't actually send an email; it just opens the message composing window.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close