Bayern
Bayern

Reputation: 350

Add an attachment to a email in c#

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:" + "[email protected]" + "?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.

Upvotes: 0

Views: 186

Answers (4)

Ahmed Abd Ellatif
Ahmed Abd Ellatif

Reputation: 195

can use :

&attach=filename

Upvotes: -1

Kevin
Kevin

Reputation: 1472

Use:

&attach=C:\Documents%20and%20Settings\username\Desktop\foldername\NameOfFile.txt

Upvotes: -1

Zohar Peled
Zohar Peled

Reputation: 82474

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.

Upvotes: 2

Related Questions