0

How can I add an attachment to the mailto function in C#?

This is what I have so far:

 VWGClientContext.Current.Invoke("(function() {window.location.href='mailto:" + "myemail@outlook.com" + "?Subject=" + "SubjectText" + "&body=" + "BodyText" + "'; })();");

Is it something like this "&Attachment=" ....?

The file that needs to be added is stored on a server not a local pc.

Bayern
  • 330
  • 3
  • 20
  • 1
    possible duplicate of [using mailto to send email with an attachment, html or jsf](http://stackoverflow.com/questions/5233556/using-mailto-to-send-email-with-an-attachment-html-or-jsf) – bviale May 28 '15 at 12:13
  • @bviale because the file commes from the server not from my local pc. – Bayern May 28 '15 at 12:15

4 Answers4

2

Don't use the mailto: link.
Instead, send the email from the server using the classes provided in the System.Net.Mail namespace. This way you can add the file that's on your server as an attachment, using the Attachment class. (there is a code example in the MSDN page I've linked to)

If you need to, you can have the user fill out a form with the message body and subject and send the mail using the user input.

Zohar Peled
  • 79,642
  • 10
  • 69
  • 121
1

you might be interested in this:

https://msdn.microsoft.com/en-us/library/system.net.mail.attachment%28v=vs.110%29.aspx

Amit Kumar Ghosh
  • 3,618
  • 1
  • 20
  • 24
-1

Use:

&attach=C:\Documents%20and%20Settings\username\Desktop\foldername\NameOfFile.txt
Ole Albers
  • 8,715
  • 10
  • 73
  • 166
Kevin
  • 1,462
  • 9
  • 9
-1

can use :

&attach=filename
Zohar Peled
  • 79,642
  • 10
  • 69
  • 121