I'm trying to use the fckeditor to send out an email, in a newsletter, but it doesn't send any of the text. It just sends "FredCK.FCKeditorV2.FCKeditor" every time. Here's the code I've put together, but I'm pretty new to asp.net and fckeditor, so I'm not sure where my mistake is:
Main Code:(.aspx)
Code Behind (.aspx.cs)
Main Code:(.aspx)
<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" CodeFile="MassMailer_News.aspx.cs" ValidateRequest="false" Inherits="Admin_MassMailerNews" Title="Newsletter Mailing List" %> <%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table width="100%"><tr><td> <table class="newsBox" cellspacing="0px" cellpadding="0px" width="100%"> <tr> <td class="headlinesBG">NewsLetter Mailing List</td> </tr> <tr> <td class="contentBG"> <asp:Label id="lblConfirmation" runat="server"/> <asp:Panel id="pnlForm" runat="server"> Your e-mail address: <br /> <asp:TextBox id="txtFrom" Width="350px" runat="server"/> <br /><br /> The subject of your e-mail: <br /> <asp:TextBox id="txtSubject" Width="350px" runat="server"/> <br /><br /> The body of your e-mail message (HTML tags accepted): <br /> <FCKeditorV2:FCKeditor id="txtBody" BasePath="~/FCKeditor/" runat="server" /> <br /><br /> <asp:Button id="btnSubmit" onclick="Send_Mail" text="Click here to send ==>" runat="server"/> </asp:Panel> </td> </tr> </table> </td></tr></table> </asp:Content>
Code Behind (.aspx.cs)
using System; using System.Collections; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Web.Mail; public partial class Admin_MassMailerNews : System.Web.UI.Page { //protected Panel pnlForm; //protected Label lblConfirmation; //protected TextBox txtFrom; //protected TextBox txtSubject; //protected TextBox txtBody; //protected Button btnSubmit; public void Send_Mail(object sender, EventArgs e) { pnlForm.Visible = false; SqlConnection conn = new SqlConnection("connection string goes in here;"); SqlCommand comm = new SqlCommand("SELECT DISTINCT Email FROM MyNews", conn); SqlDataReader dr; MailMessage mailer = new MailMessage(); mailer.From = txtFrom.Text.Trim(); mailer.Subject = txtSubject.Text.Trim(); mailer.Priority = MailPriority.High; mailer.Body = txtBody.ToString(); mailer.BodyFormat = MailFormat.Html; mailer.Bcc = ""; try { conn.Open(); dr = comm.ExecuteReader(CommandBehavior.CloseConnection); //loop through the records in the database table and send a message to each of the recipients while (dr.Read()) { mailer.To = dr[0].ToString(); SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mailer); } dr.Close(); lblConfirmation.Text = "Your message was successfully sent to its receipients!"; } catch (SqlException ex) { Response.Write("A database-related exception occurred!<br>" + ex.ToString()); } catch (Exception ex) { Response.Write("A general exception occurred!<br>" + ex.ToString()); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } } } }
Re: .Net FckEditor and Email problem