public void GetAssistence(Quote q, string path) { q = GetById(q.ID); q.Status = QuoteStatus.AssistenceRequired; IList <UserMember> umlst = MembershipManager.GetAdministrators(); MembershipHelperUser user = MembershipHelper.GetUser(); IList <Note> lst = ControllerManager.Note.ListByType(q.GetType(), q.ID, 1); foreach (UserMember userMember in umlst) { //PermissionManager.AddEntityPermision(q.GetType(), q.ID.ToString(), userMember.UserName); WebMailing w = new WebMailing(); string body = File.ReadAllText(Path.Combine(HttpContext.Current.Server.MapPath(Config.MailTemplatePath), "quote.htm")); body = body.Replace("[QUOTE_CONTACT]", MembershipHelper.GetUser(userMember.ID).FullName); body = body.Replace("[QUOTE_BODY]", path); body = body.Replace("[QUOTE_OBSERVATION]", lst[0].Description); body = body.Replace("[USUARIO]", user.FullName); body = body.Replace("[EMAIL]", user.Email); w.SendMail(userMember.Email, "", "Se ha solicitado asistencia en la cotización " + q.Number, body, false); } Save(q); }
public void Send(Quote q, byte[] filecontent) { string body = File.ReadAllText( Path.Combine(HttpContext.Current.Server.MapPath(Config.MailTemplatePath), "quote.htm")); string email = q.Email; if (string.IsNullOrEmpty(email)) { email = q.Distributor.Email; } if (string.IsNullOrEmpty(email)) { email = q.Distributor.AlternativeEmail; } q.Status = QuoteStatus.Sent; Save(q); this.CommitChanges(); MembershipHelperUser mhu = MembershipHelper.GetUser(q.TimeStamp.CreatedBy); body = body.Replace("[QUOTE_BODY]", Resource.Business.GetString("QuoteBody")); body = body.Replace("[QUOTE_OBSERVATION]", q.Observations); body = body.Replace("[USUARIO]", mhu.FullName); body = body.Replace("[EMAIL]", mhu.Email); string title = "Cotizaciones"; string subject = "Cotización para " + q.Distributor.Name; string fileName = "Cotizacion" + q.Number + ".pdf"; IList <string> lstMails = new List <string>(); lstMails.Add(email); if (mhu != null) { lstMails.Add(mhu.Email); } if (ControllerManager.Lookup.List(LookupType.AdministratorReceiveMail)[0].Description == "True") { IList <UserMember> umlst = MembershipManager.GetAdministrators(); foreach (UserMember um in umlst) { lstMails.Add(um.Email); } } WebMailing w = new WebMailing(); foreach (string currentEmail in lstMails) { w.SendMail(currentEmail, title, subject, body, false, false, mhu.Email, mhu.FullName, fileName, filecontent); } }
protected void Button1_Click(object sender, EventArgs e) { byte[] response; String filePath = Server.MapPath("/temp/") + "1.pdf"; response = File.ReadAllBytes(filePath); WebMailing wm = new WebMailing(); wm.SendMail("*****@*****.**", "title", "subject", "body", false); wm.SendMail("*****@*****.**", "title", "subject", "body", false, "cotizacion.pdf", response); //MailSender.Mail.Send(Convert.ToInt32(DropDownList1.SelectedValue), TextBox1.Text, TextBox2.Text, TextBox3.Text); }
protected void Application_Error(object sender, EventArgs e) { string error = Server.GetLastError().ToString(); if (Server.GetLastError().InnerException != null && Server.GetLastError().InnerException.GetType() == typeof(NybbleMembership.NotValidPermissionException)) { Response.Redirect("/accessdenied.aspx?Url=" + Request.Url); } #if !DEBUG Utils.GetLogger().Error(Server.GetLastError().Message, Server.GetLastError().GetBaseException()); WebMailing wm = new WebMailing(); wm.SendMail(Config.SupportEmail, "", "Error en PriceManager Advance", error, false); #endif }
protected void Page_Load(object sender, EventArgs e) { WebMailing wm = new WebMailing(); wm.SendMail("*****@*****.**", "Título del mail", "<b>Subject</b> del mail", "Cuerpo del <b>mail</b>", false); //ControllerManager.PriceAttributeHistory.GetAttributeHistoricPrices(10654); //// We should recreate the GridHelper on each postback. //if (Page.IsPostBack) // gh.RecreateFromJavascript(hidSelChecks.Value.Split(','), Convert.ToBoolean(hidAllSelected.Value)); //// We are disabling the ViewState for the GridView because we dont need it and is important for the page size. //// We will normally recreate the grid on every postback action. //// Pending to test Sorting & Click on each row event //if (!Page.IsPostBack) // LoadGrid(); }
private void Reject(Quote q, string creatoremail) { if (string.IsNullOrEmpty(creatoremail) || q.Status == QuoteStatus.Sent) { return; } q.Status = QuoteStatus.Rejected; string body = File.ReadAllText( Path.Combine(HttpContext.Current.Server.MapPath(Config.MailTemplatePath), "rejectquote.htm")); body = body.Replace("[QUOTE_BODY]", string.Format(Resource.Business.GetString("QuoteReject"), q.Number, q.Description)); body = body.Replace("[USUARIO]", MembershipHelper.GetUser().UserName); WebMailing wm = new WebMailing(); wm.SendMail(creatoremail, "Cotización Rechazada", "Cotización rechazada", body, false); }
private void SendPasswordMail(MembershipUser mu, string password) { WebMailing w = new WebMailing(); string body = File.ReadAllText(Path.Combine(HttpContext.Current.Server.MapPath(NybbleMembership.Core.Configuration.MailTemplatePath), "newpassword.htm")); body = body.Replace("[NEW_PASSWORD]", password); body = body.Replace("[USUARIO]", mu.UserName); w.SendMail(mu.Email, "Cambio de Contraseña", "Cambio de Contraseña", body, false); //SmtpClient mailclient = new SmtpClient(); //MailMessage mm = new MailMessage(); //mm.To.Add(mu.Email); //mm.Subject = "Nueva Contraseña"; //mm.Body ="Su nueva contraseña es: " + password; //mailclient.Send(mm); }
protected void btnSend_Click(object sender, EventArgs e) { MembershipUser mu = Membership.GetUser(txtUser.Text); if (mu != null) { string newPassword = mu.ResetPassword(); WebMailing w = new WebMailing(); string body = File.ReadAllText(Path.Combine(HttpContext.Current.Server.MapPath(Config.MailTemplatePath), "newpassword.htm")); body = body.Replace("[NEW_PASSWORD]", newPassword); body = body.Replace("[USUARIO]", MembershipHelper.GetUser(mu.UserName).FullName); w.SendMail(mu.Email, "Cambio de Contraseña", "Cambio de Contraseña", body, false); Flash.Attributes["class"] = "flash_notice"; lblInfo.Text = "Su contraseña fue enviada con éxito."; } else { Flash.Attributes["class"] = "flash_alert"; lblInfo.Text = "El usuario ingresado es incorrecto"; } }
public void Send(Quote q, byte[] filecontent) { MembershipHelperUser mhu = MembershipHelper.GetUser(q.TimeStamp.CreatedBy); IList <string[]> lstMails = new List <string[]>(); if (q.QuoteNotifications.Count > 0) { foreach (IQuoteNotification quoteNotification in q.QuoteNotifications) { string[] _contact = new string[2]; _contact[0] = quoteNotification.Name; _contact[1] = quoteNotification.Email; lstMails.Add(_contact); } } else { string name = q.Distributor.Contact; string email = q.Distributor.Email; if (string.IsNullOrEmpty(email)) { email = q.Distributor.AlternativeEmail; } string[] _contact = new string[2]; _contact[0] = name; _contact[1] = email; lstMails.Add(_contact); } if (mhu != null) { string[] _contact = new string[2]; _contact[0] = mhu.FullName; _contact[1] = mhu.Email; lstMails.Add(_contact); } if (ControllerManager.Lookup.List(LookupType.AdministratorReceiveMail)[0].Description == "True") { IList <UserMember> umlst = MembershipManager.GetAdministrators(); foreach (UserMember um in umlst) { string[] _contact = new string[2]; _contact[0] = um.UserName; _contact[1] = um.Email; lstMails.Add(_contact); } } string title = "Cotizaciones"; string subject = "Cotización para " + q.Distributor.Name; string fileName = "Cotizacion" + q.Number + ".pdf"; WebMailing w = new WebMailing(); foreach (string[] currentEmail in lstMails) { string body = File.ReadAllText(Path.Combine(HttpContext.Current.Server.MapPath(Config.MailTemplatePath), "quote.htm")); body = body.Replace("[QUOTE_CONTACT]", currentEmail[0]); body = body.Replace("[QUOTE_BODY]", Resource.Business.GetString("QuoteBody")); body = body.Replace("[QUOTE_OBSERVATION]", q.Observations); body = body.Replace("[USUARIO]", mhu.FullName); body = body.Replace("[EMAIL]", mhu.Email); w.SendMail(currentEmail[1], title, subject, body, false, false, mhu.Email, mhu.FullName, fileName, filecontent); } q.Status = QuoteStatus.Sent; if (q.SentDate == null) { q.SentDate = DateTime.Now; } repository.Save(q); repository.CommitChange(); }