2014-02-17 130 views
2

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:?

<a href="mailto:[email protected](Model.MailSubject)&[email protected](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.

回答

1

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附加文件。

作为一种替代方法,您可以使用System.Net.Mail namespace从服务器端本身发送电子邮件。

+0

是,邮寄地址不支持附件:( 通过以下链接获得相同的, 1. http://msdn.microsoft.com/en-us/library/bb644320.aspx 2. HTTP:// stackoverflow.com/questions/6148639/how-to-open-outlook-new-mail-window-c-sharp –

+0

@Sanooj VS这不会打开在服务器端而不是在本地机器上的前景? – JSON