Reputation: 1017
I am trying to get rails to select document attachments, then kick off the email client with the documents attached.
I have it working on my development laptop. If I build a string with the appropriate parameters and pass that to system() then it kicks off the email client with the attachments..
The string looks something like
@email_content = "C:\Program Files (x86)\IBM\Lotus\Notes\notes.exe" "Mailto:?Attach=C:\Users\cm\RubymineProjects\technical_library\public\images\1\8302_printed.pdf
The first part calls the notes exe and the second part starts and email with the attachments. That worked fine on my laptop.
However, when I moved it to the server, it isn't kicking off the email client. I believe that it is because the shell commands are trying to execute on the server, not on the client.
Is it possible to run a shell command on the client machine? I am trying to get this working with Windows first and then the Mac environmemnt. I tried changing the C:\ to the machine name. i.e. \chrislaptop\Program Files (x86)\IBM\Lotus\Notes\notes.exe. but that didn't work.
Upvotes: 0
Views: 79
Reputation: 895
Arbitrary code execution escaping the browser is too invasive-- your app should not have access to the client's machine.
However, some applications may support URIs that open specific applications outside the browser. You generally see this more on mobile devices, but Spotify for example supports links that look like: spotify:artist:5lsC3H1vh9YSRQckyGv0Up
which asks the user whether it is ok to open the Spotify application.
https://news.spotify.com/us/2008/01/14/linking-to-spotify/
Upvotes: 1
Reputation: 15525
No, fortunately that is not possible.
Imagine what happens when a request to some random page on the internet could trigger shell scripts on your local computer...
Upvotes: 5