Send Email Using Editor
Clash Royale CLAN TAG#URR8PPP
Send Email Using Editor
I am using Editor with preview
Everything is working properly but I can't seem to get any value from the form editor.
I want to mail this edited content but do not get how to get it
CS and asp code
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>
<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>
<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:// "Link title")" 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
2. Item 2
3. Item 3
" 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 |Second Header
------------- |-------------
Content cell 1 |Content cell 2
Content cell 3 |Content cell 4
" 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 --%>
You cannot use a div element for the source. It does not get posted to the server. The content of the editor is usually in a TextArea. That is what you need to use.
– VDWWD
Aug 13 at 8:51
yeah, what will be posted is the content of
txtmailtemplate
, and this should be its name
attribute too. if you need to post the content of the preview1mailbody, you'd have to somehow transport the content to a posted control first, for example an input type=hidden or a hidden textarea, or use ajax– dlatikay
Aug 13 at 9:23
txtmailtemplate
name
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
There is no jQuery in your post.
– mplungjan
Aug 13 at 8:32