這篇Emial用的是用的是第三方的Email引擎,如果你想用自己的郵箱引擎的話,得自己寫(xiě)一個(gè),而且是要收費(fèi)的.我暫時(shí)還沒(méi)研究郵箱引擎的原理.如果讀者知道的話,望賜教.
創(chuàng)新互聯(lián)專注于開(kāi)陽(yáng)企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站設(shè)計(jì),成都做商城網(wǎng)站。開(kāi)陽(yáng)網(wǎng)站建設(shè)公司,為開(kāi)陽(yáng)等地區(qū)提供建站服務(wù)。全流程按需制作網(wǎng)站,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)using System; using System.Collections.Generic; using System.Linq; using System.Web; //////ainyTools 的摘要說(shuō)明 /// public class ainyTools { private ainyTools(){} private static string NO_THIS_USER = "登錄失敗×您可能還沒(méi)注冊(cè)"; private static string NO_POWERS = "您沒(méi)有任何權(quán)限,請(qǐng)申請(qǐng)"; private static string NO_THIS_POWER = "您沒(méi)有此項(xiàng)權(quán)限,請(qǐng)申請(qǐng)"; private static string SURE_COMEIN = "succ"; private static string SUPER_ID = "superId"; private static int SESSION_TIME_OUT = 30; private static string IS_SUPER = "isSuper"; private static string IS_ORDINARY = "isOrdinary"; private static string ERROR_NO_Session = "nS"; private static string ERROR_NO_Have = "no"; private static string BACK_FAILE = "f"; private static string BACK_SUCC = "s"; private static string Power_App = "權(quán)限申請(qǐng)"; ////// 權(quán)限申請(qǐng)標(biāo)題 /// public static string _Power_App { get { return ainyTools.Power_App; } } ////// 操作成功 /// public static string _BACK_SUCC { get { return ainyTools.BACK_SUCC; } } ////// 操作失敗 /// public static string _BACK_FAILE { get { return ainyTools.BACK_FAILE; } } ////// 沒(méi)有相關(guān)的信息 /// public static string _ERROR_NO_Have { get { return ainyTools.ERROR_NO_Have; } } ////// 沒(méi)有Session /// public static string _ERROR_NO_Session { get { return ainyTools.ERROR_NO_Session; } } //這里是郵件的系統(tǒng) private static string mailServerName = "smtp.126.com"; //發(fā)送郵件的SMTP服務(wù)器 private static string mailFrom = "XXX@126.com"; //發(fā)件人郵箱(用126的郵件服務(wù)器,就必須用126郵箱的用戶名) private static string mailTo = "ROOT@126.com"; //收件人郵箱 private static string User_Reg_App = "用戶注冊(cè)申請(qǐng)!"; public static string _User_Reg_App_Title { get { return ainyTools.User_Reg_App; } } public static string _mailServerName { get { return ainyTools.mailServerName; } } public static string _mailFrom { get { return ainyTools.mailFrom; } } public static string _mailTo { get { return ainyTools.mailTo; } } public static string _IS_ORDINARY { get { return ainyTools.IS_ORDINARY; } } public static string _IS_SUPER { get { return ainyTools.IS_SUPER; } } public static int _SESSION_TIME_OUT { get { return ainyTools.SESSION_TIME_OUT; } } public static string _SUPER_ID { get { return ainyTools.SUPER_ID; } } public static string _SURE_COMEIN { get { return ainyTools.SURE_COMEIN; } } public static string _NO_THIS_POWER { get { return ainyTools.NO_THIS_POWER; } } public static string _NO_THIS_USER { get { return ainyTools.NO_THIS_USER; } } public static string _NO_POWERS { get { return ainyTools.NO_POWERS; } } }
郵件發(fā)送器:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Net.Mail; //////EmailManager 的摘要說(shuō)明 ///收發(fā)郵件 /// public class EmailManager{ private EmailManager(){} public static bool sendEmailInfo(string title,string body){ MailAddress from = new MailAddress(ainyTools._mailFrom, "siyecompanyDIZHAI"); MailMessage mail = new MailMessage(); mail.Subject = title; mail.From = from; mail.To.Add(new MailAddress(ainyTools._mailTo, "siyesoft")); mail.Body = body; mail.BodyEncoding = System.Text.Encoding.UTF8; mail.IsBodyHtml = true; mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess; SmtpClient clientA = new SmtpClient(); try{ clientA.Host = ainyTools._mailServerName; }catch (Exception e) { return false; } clientA.UseDefaultCredentials = false; clientA.Credentials = new System.Net.NetworkCredential("siyecompanyDIZHAI", "填寫(xiě)密碼"); clientA.DeliveryMethod = SmtpDeliveryMethod.Network; try{ clientA.Send(mail); return true; } catch (Exception e1) { return false; } } }
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國(guó)云服務(wù)器,動(dòng)態(tài)BGP最優(yōu)骨干路由自動(dòng)選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機(jī)房獨(dú)有T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確進(jìn)行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動(dòng)現(xiàn)已開(kāi)啟,新人活動(dòng)云服務(wù)器買多久送多久。