/// <summary> /// Send mails for a workflow /// </summary> /// <param name="email"></param> /// <param name="title"></param> /// <param name="subject"></param> /// <param name="body"></param> private void sendMail(eMail email, string title, string subject, string body) { BBCode bbc = new BBCode(); body = bbc.Transform(body); var listToParse = new List <eMail_KeyValuePair>(); listToParse.Add(new eMail_KeyValuePair() { key = "{title}", value = title }); listToParse.Add(new eMail_KeyValuePair() { key = "{subject}", value = subject }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_name}", value = Configuration_BSO.GetCustomConfig("title") }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_url}", value = Configuration_BSO.GetCustomConfig("url.application") }); listToParse.Add(new eMail_KeyValuePair() { key = "{body}", value = body }); email.Subject = subject; email.Body = email.ParseTemplate(Properties.Resources.template_NotifyWorkflow, listToParse); email.Send(); }
internal void SendResetEmail(Login_DTO_Create dto, string token) { Resources.BBCode bbc = new Resources.BBCode(); using (eMail email = new eMail()) { string Body = ""; string Subject = ""; string InvitationUrl = ""; Body = Label.Get("email.body.account-reset", dto.LngIsoCode); Subject = Label.Get("email.subject.account-reset", dto.LngIsoCode); InvitationUrl = "[url=" + Configuration_BSO.GetCustomConfig(ConfigType.global, "url.application") + Utility.GetCustomConfig("APP_COOKIELINK_INVITATION_1FA") + '/' + dto.CcnUsername + '/' + token + "]" + "[/url]"; Body = Body + Environment.NewLine + InvitationUrl; Body = bbc.Transform(Body, true); email.Body = Body; email.Subject = Subject; email.To.Add(dto.CcnEmail); email.Send(); } }
public string OutLookEventMail(eMail mail) { try { Application outlookapp = new Application(); MailItem mailitem = (MailItem)outlookapp.CreateItem(OlItemType.olMailItem); if (mailitem != null) { mailitem.BodyFormat = mail.mailformat; mailitem.Subject = mail.Subject; mailitem.Body = mail.Body; Recipient recipient = null; foreach (var receipient in mail.Receipients) { recipient = mailitem.Recipients.Add(receipient); } try { mailitem.Send(); return("Success"); } catch (System.Exception ex) { return("Fail"); } } } catch (System.Exception ex) { } return(string.Empty); }
public string SMTPMail(eMail mail) { if (mail.Receipients.Count() > 0) { MailMessage message = new MailMessage(); foreach (var receipient in mail.Receipients) { message.To.Add(receipient); // Add Receiver mail Address } message.From = new MailAddress("*****@*****.**", "Canarys Automation Pvt ltd."); // Sender address message.Subject = mail.Subject; message.IsBodyHtml = true; //HTML email message.Body = mail.Body; try { System.Net.Mail.SmtpClient smtpclient = new System.Net.Mail.SmtpClient(); //smtpclient.Host = "smtp.gmail.com"; //-------this has to given the Mailserver IP //smtpclient.Port = 587; //smtpclient.EnableSsl = true; //smtpclient.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Canarys123"); smtpclient.Send(message); return("Success"); } catch (System.Exception) { return("Fail"); } } return("No Recepient Found"); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //If we don't know who you are then we won't allow the method to execute if (Common.FirebaseId == null && SamAccountName == null) { Response.error = Label.Get("error.authentication"); return(false); } //Get a list of subscribers to the channel //If DTO.singleLangage is asserted then we only want users who prefer the associated langauge Subscription_BSO subBso = new Subscription_BSO(); var chnSubs = subBso.ChannelRead(Ado, DTO.LngIsoCode, DTO.ChnCode, DTO.singleLanguage); //Get the name of the requested channel var channel = new Channel_BSO().Read(Ado, DTO.LngIsoCode, DTO.ChnCode).data.FirstOrDefault(); string cName = ""; if (channel != null) { cName = channel.ChnName; } int attemptCounter = 0; List <string> emailsNotSent = new List <string>(); foreach (var user in chnSubs) { if (String.IsNullOrEmpty(user.CcnEmail)) { continue; } attemptCounter++; using (eMail email = new eMail()) { try { email.Body = DTO.EmailBody ?? Label.Get("email.subscription.notification-body", DTO.LngIsoCode); email.Subject = DTO.EmailSubject ?? Label.Get("email.subscription.notification-body", DTO.LngIsoCode); string salutation = String.Format(Label.Get("email.salutation-informal", DTO.LngIsoCode), user.FullName); email.To.Add(user.CcnEmail); Log.Instance.Debug($"Send notification to {user.CcnEmail}"); if (!sendMail(email, String.Format(Label.Get("email.subscription.notification-title", DTO.LngIsoCode), cName), email.Subject, email.Body, salutation)) { emailsNotSent.Add(user.CcnEmail); } } catch (Exception ex) { Log.Instance.Error("Error sending email " + ex.Message); emailsNotSent.Add(user.CcnEmail); } } } Response.data = emailsNotSent; return(true); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //Translate from bbCode to html Resources.BBCode bbc = new Resources.BBCode(); DTO.Body = bbc.Transform(DTO.Body); List <string> groupCodes = new List <string>(); GroupAccount_ADO gAdo = new GroupAccount_ADO(); foreach (var code in DTO.GroupCodes) { groupCodes.Add(code.GrpCode); } //Get accounts associated with the Group(s) ADO_readerOutput readGroupAccounts = gAdo.ReadMultiple(Ado, groupCodes); Account_ADO accAdo = new Account_ADO(); Account_DTO_Read dtoRead = new Account_DTO_Read(); dtoRead.PrvCode = Resources.Constants.C_SECURITY_PRIVILEGE_POWER_USER; ADO_readerOutput readPowerUsers = accAdo.Read(Ado, dtoRead); //Get the AD data associated with the users, specifically ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); adAdo.MergeAdToUsers(ref readGroupAccounts); adAdo.MergeAdToUsers(ref readPowerUsers); eMail email = new eMail(); if (!readGroupAccounts.hasData && !readPowerUsers.hasData) { Response.data = JSONRPC.success; Log.Instance.Debug("No email addresses found"); return(true); } foreach (var user in readGroupAccounts.data) { email.Bcc.Add(user.CcnEmail.ToString()); } foreach (var user in readPowerUsers.data) { email.Bcc.Add(user.CcnEmail.ToString()); } email.Subject = DTO.Subject; email.Body = DTO.Body; sendMail(email, Configuration_BSO.GetCustomConfig("title"), DTO.Subject, DTO.Body); Response.data = JSONRPC.success; return(true); }
/// <summary> /// Send mails for a workflow /// </summary> /// <param name="email"></param> /// <param name="title"></param> /// <param name="subject"></param> /// <param name="body"></param> private void sendMail(eMail email, string title, string subject, string body) { var listToParse = new List <eMail_KeyValuePair>(); List <string> grpCodes = new List <string>(); grpCodes = DTO.GroupCodes.Select(s => (string)s.GrpCode).ToList(); string grouplist = grpCodes.Any() ? String.Join(", ", grpCodes) : Label.Get("static.all-groups"); listToParse.Add(new eMail_KeyValuePair() { key = "{title}", value = title }); listToParse.Add(new eMail_KeyValuePair() { key = "{subject}", value = subject }); listToParse.Add(new eMail_KeyValuePair() { key = "{body}", value = body }); listToParse.Add(new eMail_KeyValuePair() { key = "{received-by}", value = string.Format(Label.Get("label.timezone", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")), grouplist) }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_name}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "title") }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_url}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "url.application") }); listToParse.Add(new eMail_KeyValuePair() { key = "{image_source}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "url.logo") }); listToParse.Add(new eMail_KeyValuePair() { key = "{datetime_label}", value = Label.Get("label.date-time", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); listToParse.Add(new eMail_KeyValuePair() { key = "{date_format}", value = Label.Get("label.date-format", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); listToParse.Add(new eMail_KeyValuePair() { key = "{timezone}", value = Label.Get("label.timezone", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); email.Subject = subject; email.Body = email.ParseTemplate(Properties.Resources.template_GroupMessage, listToParse); email.Send(); }
/// <summary> /// Send email notification after Response /// Emails sent to Group of the release and all Power Users /// </summary> /// <param name="rspDTO"></param> /// <param name="releaseDTO"></param> internal void EmailResponse(WorkflowRequest_DTO requestDTO, WorkflowResponse_DTO rspDTO, Release_DTO releaseDTO) { eMail email = new eMail(); Account_BSO aBso = new Account_BSO(); ADO_readerOutput recipients = new ADO_readerOutput(); string subject = ""; string body = ""; string releaseUrl = getReleaseUrl(releaseDTO); string rqsvalue = Label.Get("workflow.request." + requestDTO.RqsValue); switch (rspDTO.RspCode) { case Constants.C_WORKFLOW_STATUS_APPROVE: //Send the email to power users only recipients = aBso.getUsersOfPrivilege(Resources.Constants.C_SECURITY_PRIVILEGE_POWER_USER); subject = string.Format(Label.Get("email.subject.response-approve"), releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision); body = string.Format(Label.Get("email.body.response-approve"), rqsvalue, releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision, releaseUrl, rspDTO.ResponseAccount.CcnEmail, rspDTO.ResponseAccount.CcnUsername, rspDTO.ResponseAccount.CcnName); break; case Constants.C_WORKFLOW_STATUS_REJECT: //Send the email to recipients = aBso.getReleaseUsers(releaseDTO.RlsCode, false); subject = string.Format(Label.Get("email.subject.response-reject"), releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision); body = string.Format(Label.Get("email.body.response-reject"), rqsvalue, releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision, releaseUrl, rspDTO.ResponseAccount.CcnEmail, rspDTO.ResponseAccount.CcnUsername, rspDTO.ResponseAccount.CcnName); break; } List <string> allEmails = new List <string>(); allEmails.AddRange(getEmailAddresses(recipients)); if (allEmails.Count == 0) { return; } foreach (string person in allEmails) { email.Bcc.Add(person); } sendMail(email, Configuration_BSO.GetCustomConfig("title"), subject, body); email.Dispose(); }
/// <summary> /// Send mails for a workflow /// </summary> /// <param name="email"></param> /// <param name="title"></param> /// <param name="subject"></param> /// <param name="body"></param> private void sendMail(eMail email, string title, string subject, string body) { BBCode bbc = new BBCode(); body = bbc.Transform(body, true); var listToParse = new List <eMail_KeyValuePair>(); listToParse.Add(new eMail_KeyValuePair() { key = "{title}", value = title }); listToParse.Add(new eMail_KeyValuePair() { key = "{subject}", value = subject }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_name}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "title") }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_url}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "url.application") }); listToParse.Add(new eMail_KeyValuePair() { key = "{body}", value = body }); listToParse.Add(new eMail_KeyValuePair() { key = "{image_source}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "url.logo") }); listToParse.Add(new eMail_KeyValuePair() { key = "{datetime_label}", value = Label.Get("label.date-time", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); listToParse.Add(new eMail_KeyValuePair() { key = "{date_format}", value = Label.Get("label.date-format", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); listToParse.Add(new eMail_KeyValuePair() { key = "{timezone}", value = Label.Get("label.timezone", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); listToParse.Add(new eMail_KeyValuePair() { key = "{reason}", value = Label.Get("workflow.reason", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); email.Subject = subject; email.Body = email.ParseTemplate(Properties.Resources.template_NotifyWorkflow, listToParse); email.Send(); }
private void frmOrder_Load(object sender, System.EventArgs e) { oeMail = new eMail(); this.txtAccountID.Focus(); DataTable dt = Global.oMySql.GetDataTable("SELECT * FROM mailserver.virtual_domains Where active='1'"); foreach (DataRow row in dt.Rows) { txtDomains.Items.Add(row["name"].ToString()); } }
/// <summary> /// Builds an email based on the template /// </summary> /// <param name="email"></param> /// <param name="title"></param> /// <param name="subject"></param> /// <param name="body"></param> /// <param name="salutationRecipient"></param> private bool sendMail(eMail email, string title, string subject, string body, string salutationRecipient) { var listToParse = new List <eMail_KeyValuePair>(); listToParse.Add(new eMail_KeyValuePair() { key = "{title}", value = title }); listToParse.Add(new eMail_KeyValuePair() { key = "{subject}", value = subject }); listToParse.Add(new eMail_KeyValuePair() { key = "{salutation}", value = salutationRecipient }); listToParse.Add(new eMail_KeyValuePair() { key = "{body}", value = body }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_name}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "title") }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_url}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "url.application") }); listToParse.Add(new eMail_KeyValuePair() { key = "{image_source}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "url.logo") }); listToParse.Add(new eMail_KeyValuePair() { key = "{datetime_label}", value = Label.Get("label.date-time", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); listToParse.Add(new eMail_KeyValuePair() { key = "{date_format}", value = Label.Get("label.date-format", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); listToParse.Add(new eMail_KeyValuePair() { key = "{timezone}", value = Label.Get("label.timezone", Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code")) }); email.Subject = subject; email.Body = email.ParseTemplate(Properties.Resources.template_NotifyChannelSubscription, listToParse); return(email.Send()); }
/// <summary> /// Send emails for a Signoff /// </summary> /// <param name="sgnDTO"></param> internal void EmailSignoff(WorkflowRequest_DTO requestDTO, WorkflowSignoff_DTO sgnDTO, Release_DTO releaseDTO, ADO_readerOutput moderators, ADO_readerOutput powerUsers) { eMail email = new eMail(); List <string> emailsAll = new List <string>(); emailsAll.AddRange(getEmailAddresses(powerUsers)); emailsAll.AddRange(getEmailAddresses(moderators)); if (emailsAll.Count == 0) { return; } foreach (string person in emailsAll) { email.Bcc.Add(person); } string subject = ""; string body = ""; string releaseUrl = getReleaseUrl(releaseDTO); string rqsvalue = Label.Get("workflow.request." + requestDTO.RqsValue); switch (sgnDTO.SgnCode) { case Constants.C_WORKFLOW_STATUS_APPROVE: subject = string.Format(Label.Get("email.subject.signoff-approve"), releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision); body = string.Format(Label.Get("email.body.signoff-approve"), rqsvalue, releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision, releaseUrl, sgnDTO.SignoffAccount.CcnEmail, sgnDTO.SignoffAccount.CcnUsername, sgnDTO.SignoffAccount.CcnName); break; case Constants.C_WORKFLOW_STATUS_REJECT: subject = string.Format(Label.Get("email.subject.signoff-reject"), releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision); body = string.Format(Label.Get("email.body.signoff-reject"), rqsvalue, releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision, releaseUrl, sgnDTO.SignoffAccount.CcnEmail, sgnDTO.SignoffAccount.CcnUsername, sgnDTO.SignoffAccount.CcnName); break; } sendMail(email, Configuration_BSO.GetCustomConfig("title"), subject, body); email.Dispose(); }
/// <summary> /// Send email notifications after a WorkflowRequest has been created. /// Emails sent to the Group of the release /// </summary> /// <param name="requestDTO"></param> /// <param name="releaseDTO"></param> internal void EmailRequest(WorkflowRequest_DTO requestDTO, Release_DTO releaseDTO) { eMail email = new eMail(); var v = getReleaseUrl(releaseDTO); Account_BSO aBso = new Account_BSO(); ADO_readerOutput approvers = aBso.getReleaseUsers(releaseDTO.RlsCode, true); if (!approvers.hasData) { return; } List <string> emails = getEmailAddresses(approvers); if (emails.Count == 0) { return; } foreach (string person in emails) { email.Bcc.Add(person); } string rqsvalue = Label.Get("workflow.request." + requestDTO.RqsValue); string releaseUrl = getReleaseUrl(releaseDTO); String subject = string.Format(Label.Get("email.subject.request-create"), releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision); String body = string.Format(Label.Get("email.body.request-create"), rqsvalue, releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision, releaseUrl, requestDTO.RequestAccount.CcnEmail, requestDTO.RequestAccount.CcnUsername, requestDTO.RequestAccount.CcnName); sendMail(email, Configuration_BSO.GetCustomConfig("title"), subject, body); email.Dispose(); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { if (Common.FirebaseId == null && SamAccountName == null) { Response.error = Label.Get("error.authentication"); return(false); } using (eMail email = new eMail()) { string Body = ""; string Subject = ""; Body = Label.Get("email.body.subscription-notification", DTO.LngIsoCode); Subject = Label.Get("email.subject.subscription-notification", DTO.LngIsoCode); email.Body = Body; email.Subject = Subject; // Get user from FirebaseId Subscriber_BSO sbso = new Subscriber_BSO(); var user = sbso.GetSubscribers(Ado, Common.FirebaseId); if (user.FirstOrDefault() == null) { Log.Instance.Debug("Cannot send notification because email address is null"); Response.error = Label.Get("error.notification"); return(false); } // Get email address from user string emailAddress = user.FirstOrDefault().CcnEmail; email.To.Add(emailAddress); Log.Instance.Debug($"Send notification to {emailAddress}"); email.Send(); } return(true); }
/// <summary> /// Send mails for a workflow /// </summary> /// <param name="email"></param> /// <param name="title"></param> /// <param name="subject"></param> /// <param name="body"></param> private void sendMail(eMail email, string title, string subject, string body) { var listToParse = new List <eMail_KeyValuePair>(); List <string> grpCodes = new List <string>(); grpCodes = DTO.GroupCodes.Select(s => (string)s.GrpCode).ToList(); listToParse.Add(new eMail_KeyValuePair() { key = "{title}", value = title }); listToParse.Add(new eMail_KeyValuePair() { key = "{subject}", value = subject }); listToParse.Add(new eMail_KeyValuePair() { key = "{body}", value = body }); listToParse.Add(new eMail_KeyValuePair() { key = "{grouplist}", value = grpCodes.Any() ? String.Join(", ", grpCodes) : Label.Get("static.all-groups") }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_name}", value = Configuration_BSO.GetCustomConfig("title") }); listToParse.Add(new eMail_KeyValuePair() { key = "{website_url}", value = Configuration_BSO.GetCustomConfig("url.application") }); email.Subject = subject; email.Body = email.ParseTemplate(Properties.Resources.template_GroupMessage, listToParse); email.Send(); }
internal static void SendLoginTemplateEmail(string subject, List <string> addressTo, string header, string content, string footer, string subHeader, string lngIsoCode, List <string> addressCc = null, List <string> addressBcc = null) { using (eMail email = new eMail()) { email.Subject = subject; foreach (string to in addressTo) { email.To.Add(to); } if (addressCc != null) { foreach (string cc in addressCc) { email.CC.Add(cc); } } if (addressBcc != null) { foreach (string bcc in addressBcc) { email.Bcc.Add(bcc); } } var listToParse = new List <eMail_KeyValuePair>(); string body = header + Environment.NewLine + content + Environment.NewLine + footer; listToParse.Add(new eMail_KeyValuePair() { key = "{header}", value = header }); listToParse.Add(new eMail_KeyValuePair() { key = "{sub_header}", value = subHeader }); listToParse.Add(new eMail_KeyValuePair() { key = "{content}", value = content }); listToParse.Add(new eMail_KeyValuePair() { key = "{footer}", value = footer }); listToParse.Add(new eMail_KeyValuePair() { key = "{subject}", value = subject }); listToParse.Add(new eMail_KeyValuePair() { key = "{image_source}", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "url.logo") }); listToParse.Add(new eMail_KeyValuePair() { key = "{datetime_label}", value = Label.Get("label.date-time", lngIsoCode) }); listToParse.Add(new eMail_KeyValuePair() { key = "{date_format}", value = Label.Get("label.date-format", lngIsoCode) }); listToParse.Add(new eMail_KeyValuePair() { key = "{timezone}", value = Label.Get("label.timezone", lngIsoCode) }); email.Body = email.ParseTemplate(Properties.Resources.template_Login, listToParse); try { email.Send(); } catch (Exception ex) { Log.Instance.Error("Email failure: " + ex.Message); } } }
//需要调用窗体名称 System.Windows.Forms.Control INetUserControl.CreateControl(UFSoft.U8.Framework.Login.UI.clsLogin login, string MenuID, string Paramters) { //UFSoft.U8.Framework.LoginContext.UserData LoginInfo = new UFSoft.U8.Framework.LoginContext.UserData(); //LoginInfo = login.GetLoginInfo(); //string conn = LoginInfo.ConnString; //conn = Utils.ConvertConn(conn); //DbHelperSQL.connectionString = conn; //string sLogUserid = LoginInfo.UserId; //string sLogUserName = LoginInfo.UserName; //string sLogDate = LoginInfo.operDate; //string sAccID = LoginInfo.AccID; UFSoft.U8.Framework.LoginContext.UserData LoginInfo = new UFSoft.U8.Framework.LoginContext.UserData(); LoginInfo = login.GetLoginInfo(); string conn = LoginInfo.ConnString; conn = Utils.ConvertConn(conn); DbHelperSQL.connectionString = conn; string sLogUserid = LoginInfo.UserId; string sLogUserName = LoginInfo.UserName; string sLogDate = LoginInfo.operDate; string sAccID = LoginInfo.AccID; bool bRight = false; if (sLogUserid.ToLower() == "demo") { bRight = true; } else { string sSQL = "select * from _UserRight where UserID = '" + sLogUserid + "' and FormID = '1110'"; DataTable dt = DbHelperSQL.Query(sSQL); if (dt != null && dt.Rows.Count > 0 && dt.Rows[0][0].ToString().Trim() != "") { bRight = true; } } if (!bRight) { throw new Exception("没有权限"); //return null; } else { eMail fm = new eMail(); fm.Conn = conn; fm.sUserID = sLogUserid; fm.sUserName = sLogUserName; fm.sLogDate = sLogDate; this._Title = "邮件设置"; return(fm); } }