使用< a href =" mailto:附加文件? [英] Attach files using <a href="mailto:?

查看:83
本文介绍了使用< a href =" mailto:附加文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码段: 它打开带有邮件主题的Outlook,但无法附加文件.实际上,我正在尝试在MVC4视图中附加两个文件,这就是为什么MailAttachment [0].

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>

我不需要调用任何操作方法,因此可以尝试在视图本身中打开Outlook.

I don't required to call any action methods, so that am trying to open the outlook in view itself.

推荐答案

除非您为客户端文件提供了正确的路径,否则您不能使用带有服务器端代码(剃刀代码)的mailto附加客户端文件.

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方案不正式支持附件.

Also MailTo Scheme doesn't support Attachments officially.

作为替代方法,您可以使用

As an alternative, you can send email from server side itself using System.Net.Mail namespace.

这篇关于使用&lt; a href =&quot; mailto:附加文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆