我有一个asp.net MVC 3 Web应用程序,在某些页面中我显示了一个条形图。
现在,用户正在询问" mailto "该页面中的链接类型以及点击该链接时,电子邮件客户端应该打开,其中TO,Subject&正文将自动填充,条形图应显示在正文中。
我知道" mailto"有限制,我们可以使用下面的简单文本准备正文,但是有没有办法将图表放在电子邮件正文中?
<A HREF="mailto:help@webcodehelpers.com?Subject=Help&Body=Hello%20%22Name%22%0A%0AWe%20are%20very%20happy%20for%20visiting%20our%20website%20webcodehelpers.com%20portal%2C%20which%20is%20providing%20useful%20information%20%2C%20code%20snippets%20and%20live%20examples.%0A%0AWe%20also%20providing%20Interview%20tip%20to%20all%20the%20freshers%20in%20web%20development%20and%20experienced%20people%20also%0A%0A%0AThanks%2C%0AWebCodeHelpers.com%20Team">Check Mail</A>
答案 0 :(得分:0)
mailto
协议非常有限。您可能需要从服务器发送电子邮件。
答案 1 :(得分:0)
using Microsoft.Office.Interop.Outlook;
public void Sendemail()
{
try
{
Application oApp = new Application();
MailItem oMsg = (MailItem)(oApp.CreateItem(OlItemType.olMailItem));
// Set HTMLBody.
const string emailSubject = "Auto Generated Email:Graph Screen Shot Update for";
const string sDisplayName = "MyAttachment";
const int iPosition = 50; //
const int iAttachType = (int)OlAttachmentType.olByValue;
string htmlStart = "<html><body><h5><Font Color=Purpel>Hi,<br/>Please Find below The screen shot as of " + DateTime.Now + "<br/></h5>";
string body = string.Empty;
Microsoft.Office.Interop.Outlook.Attachment oAttach = oMsg.Attachments.Add(@"c:\Apps\download.jpg", iAttachType, iPosition, sDisplayName);
body += "<img src=\"cid:" + oAttach.FileName + "\" /><br/>";
string wholeBody = htmlStart + body + "<h5><Font Color=Purpel>Note:Please check the graph.<br/>Regards,<br/>Md. Ajmal<br/><br/></h5></body></html>";
oMsg.HTMLBody = wholeBody;
// Set the subject.
oMsg.Subject = emailSubject;
//display
oMsg.Display(oMsg);
// Clean up.
oMsg = null;
oApp = null;
}
catch (System.Exception ex)
{
throw ex;
}
}