-4

How to use mailto: protocol to attache a file

https://codepen.io/Su1312/pen/bGEQgKv

function sendMail() {
    var link = "mailto:me@example.com"
             + "?cc=myCCaddress@example.com"
             + "&subject=" + escape("This is my subject")
             + "&body=" + escape(document.getElementById('myText').value)
    ;

    window.location.href = link;
}
Charlie
  • 22,886
  • 11
  • 59
  • 90
Maximus Su
  • 17
  • 7

1 Answers1

-1

It is not possible to attach file via mailto: protocol.

The file is in the client computer and there is no way for a website to know which files are in the users hard disk.

Even if it knew, it would be a huge security threat that any random website can get to have an email sent with a file of choice in users computer.

Here is a related question: using mailto to send email with an attachment

Charlie
  • 22,886
  • 11
  • 59
  • 90