简体   繁体   中英

OS X: open e-mail client, create new mail and add file as attachment

We want to make it for users of our (Java) application as easy as possible to send bug-logs to us. First, we imagined to open a bug-report page of our website and prefill an up-load-input field with the path of the file to upload, but this does not work for security reasons.

Is it possible on OS X (command line call, Apple Script, what ever) to open a new e-mail in the default e-mail client and add a certain file as attachment?

You can do this from the command line (terminal). Here's an example:

open -a Mail filetosend.ext

This opens the Mac Mail app, creates a message and attaches the file, ready to send.

Does it necessarily have to be an attachment? You could inline text based info in the message body using the bog standard mailto: URL which would work in any OS and any email client.

Unfortunately there's no standard way to attach a file; you'd have to write a separate script for any of the many email clients the user has installed, and that's assuming they actually use an email client—many people use Gmail, for example.

If you can't encode the information in text, you can just submit the report by HTTP(S) yourself. There are several open source frameworks that can help with this, such as FeedbackReporter (which uses HTTP) and UKFeedbackProvider (for email).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM