Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

My requirement is simple. Launch Mail.app and create a blank email and attach a file/files.

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

Thanks for any guidance.

like image 345
mootymoots Avatar asked Feb 02 '26 22:02

mootymoots


1 Answers

This works fine:

[[NSWorkspace sharedWorkspace] openFile:@"/path/to/file/file.ext" withApplication:@"Mail"];
like image 172
mootymoots Avatar answered Feb 05 '26 12:02

mootymoots



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!