1、 郵件收發
IMAP:可以在服務器上建文件夾保存接收郵件
通過程序發郵件
1.1純文本郵件
//創建一封郵件
MailMessage msg = new MailMessage();
msg.From = new MailAddress("[email protected]");
msg.To.Add(new MailAddress("[email protected]"));
msg.Subject = "去給我帶份飯";
msg.SubjectEncoding = Encoding.GetEncoding("gb2312");
msg.Body = "在中午12點之前把飯送過來";
msg.BodyEncoding = Encoding.GetEncoding("gb2312");
//用SmtpClient發送
SmtpClient smtp = new SmtpClient();
smtp.Host = "localhost";
smtp.Credentials = new NetworkCredential("sk", "123");
smtp.Send(msg);
Console.WriteLine("發送完畢!");
1.2發HTML文件
1.2.1方式一:
msg.Body = "在中午<font color='red'><h1>12:00</h1></font>之前把飯送過來。";
//設置文本正文是否是html格式
msg.IsBodyHtml = true;
1.2.2方式二:
msg.Body = "在中午12:00之前把飯送過來";
msg.BodyEncoding = Encoding.GetEncoding("gb2312");
//創建一個html格式的文檔
AlternateView aview = AlternateView.CreateAlternateViewFromString("在中午<font color='red'><h1>12:00</h1></font>之前把飯送過來。", Encoding.GetEncoding("gb2312"), "text/html");
msg.AlternateViews.Add(aview);
1.3發送圖片
//創建一個html格式的文檔
AlternateView aview = AlternateView.CreateAlternateViewFromString("在中午<font color='red'><h1>12:00</h1></font>之前把飯送過來。<br/><img src='cid:img001'/>", Encoding.GetEncoding("gb2312"), "text/html");
//爲郵件中增加一張圖片
LinkedResource resource = new LinkedResource(@"c:\toyou.jpg");
resource.ContentId = "img001";
aview.LinkedResources.Add(resource);
msg.AlternateViews.Add(aview);
1.4增加附件
Attachment attachFile1 = new Attachment(@"c:\1.cs");
Attachment attachFile2 = new Attachment(@"c:\toyou.jpg");
msg.Attachments.Add(attachFile1);
msg.Attachments.Add(attachFile2);
2、 三層項目的知識點總結
NPOI、導入導出、MD5實現登錄、數據通過FTP進行同步、拼音檢索(通過數據庫冗餘提高速度)、複合檢索、話術管理(樹狀數據結構存儲、遞歸)、三層、代碼生成器
3、HTML