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

2

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.

Stylus answered 28/12, 2011 at 15:38 Comment(1)
This is not possible, you have to send a email from a server which can attach it.Melisa
N
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.

Nicolettenicoli answered 28/12, 2011 at 15:48 Comment(3)
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 :)Stylus
Just a thought, would you be able to attach a file through ftp? (ex. ftp.something.com/file.pdf)?Stylus
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.Nicolettenicoli
C
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:[email protected]?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:[email protected]?body=the attached file is at this link: %link%">

Crankpin answered 28/12, 2011 at 15:48 Comment(1)
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 fileStylus

© 2022 - 2024 — McMap. All rights reserved.