Last post Mar 19, 2014 01:32 PM by Foziakhan
Mar 15, 2014 07:25 AM|Foziakhan|LINK
I developed a website which has a text area where user can write the text and also it has controls to upload images and document but he has to place the <img> tag in text area to include those images. But now user want a smart editor where he can simply write
the text and paste the images(or he can paste the whole contents from word document) and send the mail. Actually he want WYSIWYG mail editor (also with all the text formatting options) to send mail with images . Can anybody please tell me how to develop such
a smart editor or if any such third party editor available which I can use.
Any help will be appreciated.
Thanks and Regards
Mar 15, 2014 07:59 AM|Mikesdotnetting|LINK
If you want images to appear in emails, they have to be uploaded to a public facing web server first. You can provide the user with CKEditor (http://ckeditor.com/) and a file browser. I've covered how to develop a file
browser for Razor Web Pages but you can adapt the code easily enough for Web Forms or MVC: http://www.mikesdotnetting.com/Article/212/A-CKEditor-File-Browser-For-ASP.NET-Web-Pages
Mar 15, 2014 08:50 AM|Rion Williams|LINK
There are tons of Rich-Text Editors out there and I'll list a few different options below. If you are interested in those that are used by this forum, you may want to check out the TinyMCE Editor (as that is what these forums use).
Rich Text Editor Options
If you are familar with the AJAXControlToolkit, a common set of controls and extensions for Web Forms, then you may want to consider checking out their HTMLEditorExtender as
well, which would simply require you to just drop the necessary control within your page.
If you need some more resources, check out these breakdowns and discussions other different editors. I would encourage you to skim through this and use the demos for ones that appear to meet your needs :
Regarding Uploading Images
As Mike mentioned, if you intend to use an editor to upload images to be sent through the e-mails then you will need to actually upload the images prior to sending your e-mail. The images will need to be referenced within the e-mail through a publically
accessible absolute URL in order to be seen at all. Some of the editors that were previously mentioned support the use of Images, so you may want to consider using one of them as a starting point.
Mar 19, 2014 01:32 PM|Foziakhan|LINK
Thanks a lot Mike & Rion..................
First I tried CK editor.. but was not able to properly include it in my code. After that i tried AjaxControltoolkit HTML editor which is properly displaying with all the options but when i am trying to insert the image it is showing message "uploaded 100%"
but image is not displaying in editor and displaying message "error" after image name. Below is the code which I have done
<section name="sanitizer" requirePermission="false" type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection, AjaxControlToolkit" />
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
<section name="sanitizer"> is giving error in both the <configSections> and <system.web> tags so thats why I have commented it.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="ajaxtoolkit" %>
<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%>
<asp:TextBox ID="txteditor" runat="server" TextMode="MultiLine" Width="95%" Height="20em" ></asp:TextBox>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="Server" />
ID="HtmlEditorExtender1" runat="server" Enabled="True" OnImageUploadComplete="saveFile" ClientIDMode="AutoID" TargetControlID="txteditor" EnableSanitization="False"
protected void saveFile(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
string filePath = "~/Images/" + e.FileName;
// Save uploaded file to the file system
var ajaxFileUpload = (AjaxFileUpload)sender;
// Update client with saved image path
e.PostedUrl = Page.ResolveUrl(filePath);
// Save your File
//// Tells the HtmlEditorExtender where the file is otherwise it will render as: <img src="" />
//e.PostedUrl = fullPath;
May be some small thing is missing, please tell me if anybody knows.
Any help will be highly appreciated.