Reputation: 279
I have the following code snippet: It is opens the outlook with mail subject, but failed to attach files. Actually i am trying attach two files in MVC4 view, thats why MailAttachment[0].
<a href="mailto:?subject=@(Model.MailSubject)&Attachment=@(Model.MailAttachment[0])">
<img src="~/Images/mail.png" />
</a>
I don't required to call any action methods, so that am trying to open the outlook in view itself.
Upvotes: 2
Views: 10955
Reputation: 17182
You cannot attach client side files using mailto with server side code (Razor code), unless you give a RIGHT path to client side file.
First you need to make the user download the file to the clientside. Then ask him to use that file to attach in the email.
Also MailTo Scheme doesn't support Attachments officially.
As an alternative, you can send email from server side itself using System.Net.Mail namespace.
Upvotes: 1