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

天大地大妈咪最大 提交于 2021-02-19 05:13:08

问题


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?


回答1:


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).




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/5351541/os-x-open-e-mail-client-create-new-mail-and-add-file-as-attachment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!