本文介绍了将Asp页插入到Outlook电子邮件的正文中.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好. 我的网页上有一个mailto:链接.按下此按钮后,我希望将网页内容显示在要发送的电子邮件正文中. 我已经阅读了有关覆盖渲染以捕获字符串中的网页html的内容,但是我需要知道如何将字符串插入电子邮件的正文中. 任何帮助表示赞赏. 代码如下:
Hello. I have a mailto: link on my webpage. When this is pressed I would like the contents of the webpage to be displayed in the body of the email to be sent. I have read about overriding render to capture the html of the webpage in a string but I need to know how to insert the string into the body of the email. Any help is appreciated. Code below:
string PageResult; protected override void Render(HtmlTextWriter writer) { // *** Write the HTML into this string builder StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); HtmlTextWriter hWriter = new HtmlTextWriter(sw); base.Render(hWriter); // *** store to a string PageResult = sb.ToString(); // *** Write it back to the server writer.Write(PageResult); } protected void emailBody() { MailMessage mm = new MailMessage(); mm.IsBodyHtml = true; mm.Body = PageResult; }
<td> <asp:HyperLink ID="HyperLink1" A href="mailto:&Subject=Services Quote&body=" runat="server">Email Quote</asp:HyperLink> </td>
推荐答案
这只是一个猜测,我可能是错的,但是如果我想设置电子邮件的正文,则可以使用Body属性的MailMessage类. Its just a guess, I may be wrong, but if I wanted to set the body of an email I''d use the Body property of the MailMessage class.
更多推荐
将Asp.net页插入到Outlook电子邮件的正文中.
发布评论