Attach file to blank email in Mail.app from my cocoa application

My requirements are simple. Launch Mail.app and create an empty letter and attach the file / files.

I saw NSWorkspace actually launch mail, but how can I effectively simulate the same functionality when you drag a file onto the mail icon? Googled to death, but always get Cocoa Touch results!

Thanks for any recommendations.

+3
source share
1 answer

This works great:

[[NSWorkspace sharedWorkspace] openFile:@"/path/to/file/file.ext" withApplication:@"Mail"];
+3
source

Source: https://habr.com/ru/post/1788793/


All Articles