最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Press button, start native email program with attachment (located on webserver) - Stack Overflow

programmeradmin1浏览0评论

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
  • file: www.something/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.

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.
  • file: www.something./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.

Share Improve this question edited Dec 28, 2011 at 15:41 Felix Kling 818k181 gold badges1.1k silver badges1.2k bronze badges asked Dec 28, 2011 at 15:38 ChizpaChizpa 4512 gold badges6 silver badges10 bronze badges 1
  • This is not possible, you have to send a email from a server which can attach it. – Niels Commented Dec 28, 2011 at 15:44
Add a ment  | 

2 Answers 2

Reset to default 5

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

a href="mailto:[email protected]?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.

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:[email protected]?subject=plaint">

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

so you can send the link to the attachment with

<a href="mailto:[email protected]?body=the attached file is at this link: %link%">

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论