FoxPro Programming
outlook 365 OAuth2
Gravatar is a globally recognized avatar based on your email address. outlook 365 OAuth2
  trial03
  All
  May 13, 2025 @ 03:18am

Dear Rick Strahl,

Microsft Exchange Online will permanently remove support for Basic authentication with Client Submission (SMTP AUTH) in September 2025.

Just wonder how vfp to send mail by using 365 OAuth2?

Thanks for the help and best regards,

Gravatar is a globally recognized avatar based on your email address. re: outlook 365 OAuth2
  Rick Strahl
  trial03
  May 13, 2025 @ 07:14am

How are you using this at this point? For end users or as part of an application? If it's the latter you probably shouldn't be using a service provider email like this, but instead use a mail service like Mailgun, SendGrid or similar dedicated for sending emails. If you're doing this for customers that use their own email providers then using GMail or Outlook mail makes more sense but this is quickly becoming a losing proposition as these companies are trying to gate-keep their solutions.

Another option is to open emails in Outlook or Gmail (or whatever mail client) with the mailto: protocol - you can feed in title and body. For more sophisticated emails it's also possible to generate an .eml file and ShellExecute() that to open in your default mail client - the .eml supports attachments (as binary data) and multi-part content so you can provide plain text and html emails.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: outlook 365 OAuth2
  trial03
  Rick Strahl
  May 13, 2025 @ 04:31pm

Dear Sir,

Thanks for the kind reply.

I using sfmail by Doug Henning to send the mail.

Could you kindly give me a sample how to open emails in Outlook or Gmail (or whatever mail client) with the mailto: protocol.

Do you have the product to make vfp send oAuth email? Like to have one if available.

Thanks and regards,

Gravatar is a globally recognized avatar based on your email address. re: outlook 365 OAuth2
  Rick Strahl
  trial03
  May 14, 2025 @ 11:16am

Using Shell Execute in FoxPro (using West Wind tools but you can find that elsewhere):

lcCmd = "mailto:email@email.com,email2@email.com?subject=" + UrlEncode("New Message" ) + "&body=" + UrlEncode("this is the text to set in the message")
ShellExecute(lcCmd)

It works but it's limited to subject and body and using plain text. You also can't control where or what opens - it's whatever the user's default email client configured is. In many cases that's not set and it'll default to the free Outlook installed in Windows now I think. If you use Gmail it can be configured to be the default mailto: handler, as does Outlook online etc. but it's a manual process that's not very obvious.

It depends on what you need to do - if the needs are simple, this works well.

If you're looking for low volume emails and not emails send on behalf of a user, I'd recommend using a Mail service it's easier and uniform and you can get reliable logging and follow up information.

At this point integrating user emailing using their own accounts into an application is a major support headache unfortunately.

+++ Rick ---

© 1996-2025