问题
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