使用编辑器发送电子邮件

时间:2018-08-13 08:19:35

标签: javascript c# jquery asp.net editor

我正在使用Editor with preview

一切正常,但我似乎无法从表单编辑器中获得任何价值。

我想邮寄经过编辑的内容,但不知道如何获取

CS和ASP代码

string to = txtmailto.Value; //To address    
string from = "id"; //From address    
MailMessage message = new MailMessage(from, to);

message.Body = preview1mailbody.InnerHtml;
message.Subject = "CRM";
message.BodyEncoding = Encoding.UTF8;
message.IsBodyHtml = true;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587); //Gmail smtp   
client.EnableSsl = true;
System.Net.NetworkCredential basicCredential1 = new
System.Net.NetworkCredential("id", "pass");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = basicCredential1;
try {
  client.Send(message);
} catch (Exception ex) {
  throw ex;
}
<%--   mail SEND   --%>
  <div class="panel panel-default">
    <div class="panel-heading" style="padding: 12px; HEIGHT: 60PX;">
      <label runat="server" id="lblwish" visible="false" style="font-size: 20px; font-weight: bold; font-style: italic; font-stretch: ultra-condensed;  float: left;"></label>
      <div class="toolbar clearfix">

        <label id="alertmsg2" runat="server"></label>
        <input class="form-control table-search" autocomplete="off" type="text" placeholder="Email To" runat="server" id="txtmailto" style="float: left; width: 20%;" />
        <asp:DropDownList ID="Ddlselect" AutoPostBack="true" runat="server" CssClass="btn btn-default dropdown-toggle" OnSelectedIndexChanged="Ddlselect_SelectedIndexChanged" style="    margin-bottom: 15px !important;
    padding: 7px;">
        </asp:DropDownList>
        &nbsp; &nbsp; &nbsp;
        <asp:Button runat="server" ID="btnsentmail" Style="margin-bottom: 15px !important;" Text="Send Email" CssClass="btn btn-primary filter-dates" OnClick="btnsentmail_Click" OnClientClick="getalltxt();"></asp:Button>
        &nbsp; &nbsp; &nbsp; <label id="alertmsg" runat="server"></label>
      </div>
    </div>
  </div>
  <div class="col-md-12">
    <div class="bar">
      <ul class="markdownlive-bar bar1">
        <li title="Bold" data-before="**" data-after="**" data-placeholder="some text in bold">
          <i class="fa fa-bold"></i>
        </li>
        <li title="Italics" data-before="*" data-after="*" data-placeholder="some text in italic">
          <i class="fa fa-italic"></i>
        </li>
        <li title="Link" data-before="[ " data-after="](http:// &quot;Link title&quot;)" data-placeholder="link">
          <i class="fa fa-link"></i>
        </li>
        <li title="Image" data-before="![Alt text](" data-after=")" data-placeholder="http://">
          <i class="fa fa-picture-o"></i>
        </li>
        <li title="Unordered list" data-before="* " data-after="" data-extendselect="1">
          <i class="fa fa-list-ul"></i>
        </li>
        <li title="Ordered list" data-before="1. " data-after="" data-placeholder="Item 1&#13;2. Item 2&#13;3. Item 3&#13;" data-extendselect="1">
          <i class="fa fa-list-ol"></i>
        </li>
        <li title="Blocks" data-before="    " data-after="" data-placeholder="A block content" data-block="1" data-extendselect="1">
          <i class="fa fa-indent"></i>
        </li>
        <li title="Table" data-before="" data-placeholder="First Header  &#124;Second Header &#13;------------- &#124;------------- &#13;Content cell 1 &#124;Content cell 2 &#13;Content cell 3  &#124;Content cell 4 &#13;" data-after="" data-block="1">
          <i class="fa fa-table"></i>
        </li>
        <li title="Quote" data-before="> " data-after="" data-extendselect="1" data-block="1" data-placeholder="Quoted text">
          <i class="fa fa-quote-right"></i>
        </li>
        <li title="Horizontal rule" data-before="***" data-after="" data-extendselect="1" data-block="1">
          <i class="fa fa-ellipsis-h"></i>
        </li>
        <li title="Center" data-before="<center>" data-after="</center>" data-extendselect="1">
          <i class="fa fa-align-center"></i>
        </li>
      </ul>
    </div>
  </div>
  <div class="col-md-6">
    <textarea data-bar=".bar1" data-preview=".preview1" runat="server" id="txtmailtemplate"></textarea>
  </div>
  <div class="col-md-6">
    <div class="markdownlive-preview preview1" runat="server" id="preview1mailbody"></div>
  </div>
  <%--  END OF  mail SEND  --%>

0 个答案:

没有答案