Does anyone know how to check for a local email client in Xojo without trying to use something like System.GotoURL(“mailto:test@gmail.com”)?
The problem with the above is that it tries to launch an installed email client or give the user the chance to select one. I need something that determines if an email client is installed or not and it should work for Windows, MacOS and Linux. And even if I have to have 3 different routines using If Target… for each OS, that would be good.
Any suggestions would be appreciated.
1 Like
You could use MBS plugins or declares on macOS to determine the application meant to handle the mailto: protocol. That will tell you if / what is meant to handle a mailto: link and your app can do something with that information. I am not sure about the other platforms.
var s as String = NSWorkspaceMBS.URLForApplicationToOpenURL("mailto:jane@doe.org")
Thanks Tim, I don’t have the BMS plugins. I was hoping to do it without relying on 3rd party plugins or tools.
This gives the bundle id of the default mailto on macOS:
Declare Function LSCopyDefaultHandlerForURLScheme Lib "CoreServices.framework" (scheme As CFStringRef) As CFStringRef
Dim bundleID As String = LSCopyDefaultHandlerForURLScheme("mailto")
MessageBox("Default mail handler bundle ID: " + bundleID)
1 Like