6

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.

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
Chizpa
  • 331
  • 2
  • 3
  • 10

2 Answers2

5

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.

Rebecca
  • 577
  • 4
  • 11
  • To bad the whole idea is to attach something from the web (my webserver). I have tried the various snippets for attaching files from clients but know I need to be able to send files stored on the web :) – Chizpa Dec 28 '11 at 19:24
  • Just a thought, would you be able to attach a file through ftp? (ex. ftp://ftp.something.com/file.pdf)? – Chizpa Dec 28 '11 at 19:27
  • Yeah - there's no good way to attach a file from the web, or through FTP. Your best bet might be to include a link in the email. Otherwise, you can include instructions to the user on your webpage on how to download and attach the file themselves. – Rebecca Dec 28 '11 at 22:44
4

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%">

Uri Goren
  • 13,386
  • 6
  • 58
  • 110
  • Yeah, I am able to open my native email client using something like that :) But the real problem would be to attach a web stored file – Chizpa Dec 28 '11 at 19:25