基本信息
源码名称:WinForm HtmlEditor 编辑器 例子源码下载
源码大小:0.10M
文件格式:.rar
开发语言:C#
更新时间:2015-07-09
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
WinHtmlEditor
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Net; using System.Net.Mail; using System.IO; namespace CNPOPSOFT.Controls.Demo { public partial class MailSender : Form { public MailSender() { InitializeComponent(); } private void buttonSend_Click(object sender, EventArgs e) { //在这里输入你的邮件服务器信息,就可以发送邮件了! string host = "192.168.22.12"; int port = 25; string userid = "51aspx"; string password = "51aspx"; MailMessage message = BuildMessage(); SmtpClient smtp = new SmtpClient(host, port); smtp.Credentials = new NetworkCredential(userid, password); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; try { smtp.Send(message); MessageBox.Show("发送成功!", "示例", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("发送失败!\r\n" ex.Message, "示例", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } private MailMessage BuildMessage() { string from = "sample@sample.sample"; string to = textBoxTo.Text; string subproject = textBoxSubject.Text; string[] images = htmlEditor1.Images; string body = htmlEditor1.Text; MailMessage message = new MailMessage(); message.From = new MailAddress(from); message.To.Add(new MailAddress(to)); message.Subject = subproject; //message.IsBodyHtml = true; if (images.Length != 0) { for (int i = 0, count = images.Length; i < count; i) { string image = images[i]; if (image.Trim() == "") { continue; } if (!image.StartsWith("file")) { continue; } string path = Path.GetFullPath(image.Replace("%20", " ").Replace("file:///", "")); string cid = string.Format("image_{0:00}", i); Attachment attach = new Attachment(path); attach.Name = Path.GetFileNameWithoutExtension(path); attach.ContentId = cid; message.Attachments.Add(attach); body = body.Replace(path, string.Format("cid:{0}", cid)); } } message.Body = body; return message; } } }