13

Is it possible to attach a file using "mailto:" redirect in javascript?

Something like this:

document.location = "mailto:"+recipient+"?subject="+subject+"&body="+msg+"?attach="+"file1.zip";
Liam
  • 27,717
  • 28
  • 128
  • 190
Kiran
  • 8,034
  • 36
  • 110
  • 176

2 Answers2

21

No, you can not add an attachment to a message with the mailto: URL scheme.

mailto: only supports header values or text/plain content. See RFC 2368 for details.

Martin
  • 37,119
  • 15
  • 73
  • 82
3

You can create a custom email form, letting the user input a valid email-address if necessary and send this to the server. The server then can use a mail library to send an email including an attachment.

If you use PHP, you can easily do this using PHPMailer.

Marcel Korpel
  • 21,536
  • 6
  • 60
  • 80