private void populatePage(MMessageProfile profile) { txtMessageSeqID.Value = profile.Id.ToString(); lblName.Text = profile.Name; txtName.Text = profile.Name; txtDescription.Text = profile.Description; txtMessageTitle.Text = profile.Title; txtMessageBody.Text = profile.Body; chkFormatAsHTML.Checked = profile.FormatAsHtml; if (profile.Id == -1) { txtName.Style.Add("display", "inline"); lblName.Visible = false; } IMessageProfile mProfile = default(IMessageProfile); try { mProfile = (IMessageProfile)ObjectFactory.Create("GrowthWare.Framework", "GrowthWare.Framework.Model.Profiles", "M" + profile.Name); } catch (Exception ex) { Logger mLog = Logger.Instance(); mLog.Debug(ex); } finally { if (mProfile == null) { txtTags.Text = profile.GetTags(Environment.NewLine); } else { txtTags.Text = mProfile.GetTags(Environment.NewLine); } } }
/// <summary> /// Sends the mail. /// </summary> /// <param name="messageProfile">Object implementing IMessageProfile</param> /// <param name="accountProfile">The account profile.</param> public static void SendMail(IMessageProfile messageProfile, MAccountProfile accountProfile) { if (!canSendMail()) { return; } string mFrom = ConfigSettings.SmtpFrom; if (mFrom.Trim().Length == 0) { Logger log = Logger.Instance(); log.Error("SMTP From not set in the WEB.CONFIG file"); return; } SmtpClient mailClient = getSmtpClient(); MailMessage mailMessage = new MailMessage(new MailAddress(mFrom), new MailAddress(accountProfile.Email)); mailMessage.Subject = messageProfile.Title; messageProfile.FormatBody(); mailMessage.Body = messageProfile.Body; mailMessage.IsBodyHtml = messageProfile.FormatAsHtml; mailClient.Send(mailMessage); }