We can use our SharingService functions to share data with other applications. This includes passing styled text, containers with images, files or URLs.
Did you know we can pass styled text to Apple Mail?
Available services
Using the SharingService.ServicesForItems function, we can query the available services to request. This allows us to check which services are available and only show a button to share via Airdrop, if that is possible.
By default you have these services available on macOS:
Title | Name | Text | File Path | Images | URLs |
---|---|---|---|---|---|
Add to Photos | com.apple.share.System.add-to-iphoto | - | X | X | - |
Add to Reading List | com.apple.share.System.add-to-safari-reading-list | - | - | - | X |
AirDrop | com.apple.share.AirDrop.send | - | X | X | X |
Dropbox Transfer | com.getdropbox.dropbox.TransferExtension | - | X | X | - |
Freeform | com.apple.freeform.sharingextension | X | X | X | X |
com.apple.share.Mail.compose | X | X | X | X | |
Messages | com.apple.share.Messages.window | X | X | X | X |
Notes | com.apple.Notes.SharingExtension | X | X | X | X |
Reminders | com.apple.reminders.sharingextension | X | X | X | X |
Simulator | com.apple.iphonesimulator.ShareExtension | - | X | X | X |
If you install applications, they may offer additional services. I got Dropbox to show up here, so I included it in the table.
Send Email
Now let's send an email by sharing some text and a container with an image. The image on the right shows the Apple Mail window with styled text, but without an image.
If you don't pick a service like com.apple.share.Mail.compose, we show a menu with the plugin to pick one. For sending emails, we can pass recipients and subject lines for the email.
for the case you use email, we may predefine the subject & recipients we suggest
Set Variable [ $r ; Value: MBS("SharingService.SetEmailSubject"; "Hello") ]
Set Variable [ $r ; Value: MBS("SharingService.SetEmailRecipients"; "test@tester.test") ]
share them
Set Variable [ $r ; Value: MBS("SharingService.ShareItems";
"com.apple.share.Mail.compose";
"Dear client¶¶Hello World!";
Test::Image) ]
Set Field [ Test::Result ; $r ]
If you like to try this, please use MBS Plugin in version 15.3 with a few bug fixes in that direction. In Apple Mail, you may need to make sure the setting for new emails is set to rich text.