Press button, start native email program with attachment (located on webserver)

岁酱吖の 提交于 2019-12-12 12:28:57

问题


I have tried all different versions of send email however I have not yet achieved the following:

Javascript (or HTML) button, when pressed, open native mail application with attachment. The attachment is located on the same server as the webpage ex.:

  • web: www.something.com
  • file: www.something.com/file.pdf

The solution should not include serverside scripting (ASP/PHP) I need a simple snippet to make this happen :) Any help would be greatly appreciated.


回答1:


There is no standardized way to do this, but some email clients accept:

a href="mailto:youremail@email.com?attachment=<your filepath>"

where would have to be something like "C://Inetpub/wwwroot/myfile.pdf"

However, it will only attach something from the client's machine. You can't attach a file from the web.

Another option would be to just include a link to the file in the body of your email, or instructions to the user on how to email their attachment.




回答2:


This might not be what you're looking for, but you can send arguments to native e-mail client using the "mailto:" reference.

For example, you can set the default subject with:

<a href="mailto:your@email.com?subject=complaint">

see more at: http://msdn.microsoft.com/en-us/library/aa767737%28v=vs.85%29.aspx

so you can send the link to the attachment with

<a href="mailto:your@email.com?body=the attached file is at this link: %link%">



来源:https://stackoverflow.com/questions/8657888/press-button-start-native-email-program-with-attachment-located-on-webserver

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