public DataTable GetIPAddress(MailServices MailObj) { //SametimeServers SametimeObj = new SametimeServers(); DataTable MailServiceTable = new DataTable(); try { if (MailObj.key == 0) { string sqlQuery = "Select * from MailServices where Name='" + MailObj.Name + "'"; MailServiceTable = objAdaptor.FetchData(sqlQuery); } else { string sqlQuery = "Select * from MailServices where Name='" + MailObj.Name + "' and [key]<>" + MailObj.key + ""; MailServiceTable = objAdaptor.FetchData(sqlQuery); } } catch (Exception ex) { throw ex; } return(MailServiceTable); }
public void SendTaskErrorEmail(ActiveImagingTaskEntity task, string error) { //Mail not enabled if (SettingServices.GetSettingValue(SettingStrings.SmtpEnabled) == "0") { return; } var computer = new ComputerServices().GetComputer(task.ComputerId); foreach ( var user in _userServices.SearchUsers("").Where(x => x.NotifyError == 1 && !string.IsNullOrEmpty(x.Email))) { if (task.UserId == user.Id) { if (computer == null) { computer = new ComputerEntity(); computer.Name = "Unknown Computer"; } var mail = new MailServices { MailTo = user.Email, Body = computer.Name + " Image Task Has Failed. " + error, Subject = "Task Failed" }; mail.Send(); } } }
public RequestResult <object> Help(string Email, string Message, string UserEmail = null) { try { SystemVariableServices SV = new SystemVariableServices(); var Key = Crypto.ToBase64(SV.GetSystemVariableValue("CryptoKey")).ToString().Substring(0, 16); var Iv = Crypto.ToBase64(SV.GetSystemVariableValue("CryptoIV")).ToString().Substring(0, 16); var _Email = (!string.IsNullOrEmpty(UserEmail)) ? UserEmail : Crypto.DecryptString(Email, Key, Iv); var _Message = Crypto.DecryptString(Message, Key, Iv); var _To = SV.GetSystemVariableValue("SupportEmailInbox"); var _From = SV.GetSystemVariableValue("EgulfSupportEmail"); MailServices MailServ = new MailServices(); ITemplate factory = new TemplateMessagesFactory(); Dictionary <string, string[]> param = new Dictionary <string, string[]>(); param.Add("{Enfasis}", new string[] { _Message }); param.Add("{Text}", new string[] { _Email }); MailServ.SendMail(factory.GetTemplate(_To, "NewIncident", param, _From)); return(new RequestResult <object> { Status = Status.Success }); } catch (Exception ex) { return(new RequestResult <object> { Status = Status.Error }); } }
//delete Data from MailServices Table public Object DeleteData(MailServices MSObject) { Object Update; try { if (MSObject.key.ToString() != "") { string SqlQuery = "Delete MailServices Where [key]=" + MSObject.key; Update = objAdaptor.ExecuteNonQuery(SqlQuery); } else { Update = ""; } } catch { Update = false; } finally { } return(Update); }
public bool InsertData(MailServices MSObject) { bool Insert = false; try { DataTable MailServicesDataTable = new DataTable(); string SqlQuery = "select ID from servertypes where servertype='Mail'"; MailServicesDataTable = objAdaptor.FetchData(SqlQuery); if (MailServicesDataTable.Rows.Count > 0) { MSObject.ServerTypeId = int.Parse(MailServicesDataTable.Rows[0][0].ToString()); } SqlQuery = "INSERT INTO MailServices (Address,Name,Description,Category,ScanInterval,OffHoursScanInterval" + ",Enabled,ResponseThreshold,RetryInterval,Port,FailureThreshold,LocationId,ServerTypeId)" + "VALUES('" + MSObject.Address + "','" + MSObject.Name + "','" + MSObject.Description + "','" + MSObject.Category + "'," + MSObject.ScanInterval + "," + MSObject.OffHoursScanInterval + ",'" + MSObject.Enabled + "'," + MSObject.ResponseThreshold + "," + MSObject.RetryInterval + "," + MSObject.Port + "," + MSObject.FailureThreshold + "," + MSObject.LocationId + "," + MSObject.ServerTypeId + ")"; Insert = objAdaptor.ExecuteNonQuery(SqlQuery); } catch { Insert = false; } finally { } return(Insert); }
private bool SendEmail(OrderTaskContext context, VendorManufacturer vendorOrManufacturer, Order order) { var storeSettingsProvider = Factory.CreateStoreSettingsProvider(); var defaultCulture = storeSettingsProvider.GetDefaultLocale(); var hccRequestContext = HccRequestContextUtils.GetContextWithCulture(context.RequestContext, defaultCulture); var contentService = Factory.CreateService <ContentService>(hccRequestContext); var toEmail = vendorOrManufacturer.EmailAddress; HtmlTemplate t = null; var templateBvin = vendorOrManufacturer.DropShipEmailTemplateId; if (templateBvin != string.Empty) { long templateId = 0; long.TryParse(templateBvin, out templateId); t = contentService.HtmlTemplates.Find(templateId); } if (t == null) { t = contentService.GetHtmlTemplateOrDefault(HtmlTemplateType.DropShippingNotice); } if (!string.IsNullOrEmpty(toEmail)) { var replacers = new List <IReplaceable>(); replacers.Add(order); replacers.Add(vendorOrManufacturer); t = t.ReplaceTagsInTemplate(hccRequestContext, replacers, order.ItemsAsReplaceable()); var m = t.ConvertToMailMessage(toEmail); return(MailServices.SendMail(m, hccRequestContext.CurrentStore)); } return(false); }
public void SendLockOutEmail(int userId) { //Mail not enabled if (SettingServices.GetSettingValue(SettingStrings.SmtpEnabled) == "0") { return; } var lockedUser = GetUser(userId); foreach (var user in SearchUsers("").Where(x => x.NotifyLockout == 1 && !string.IsNullOrEmpty(x.Email))) { if (user.Membership != "Administrator" && user.Id != userId) { continue; } var mail = new MailServices { MailTo = user.Email, Body = lockedUser.Name + " Has Been Locked For 15 Minutes Because Of Too Many Failed Login Attempts", Subject = "User Locked" }; mail.Send(); } }
protected void DoExport(object objConfiguration) { try { var conf = objConfiguration as ExportConfiguration; HccRequestContext.Current = conf.HccRequestContext; DnnGlobal.SetPortalSettings(conf.DnnPortalSettings); Factory.HttpContext = conf.HttpContext; CultureSwitch.SetCulture(HccApp.CurrentStore, conf.DnnPortalSettings); var products = HccApp.CatalogServices.Products.FindByCriteria(conf.Criteria, 1, int.MaxValue, ref RowCount, false); var export = new CatalogExport(HccApp); var fileName = string.Format("Hotcakes_Products_{0}_{1:yyyyMMddhhMMss}.xlsx", HccApp.CurrentCustomerId, DateTime.UtcNow); var filePath = DiskStorage.GetStoreDataPhysicalPath(HccApp.CurrentStore.Id, "Exports/" + fileName); export.ExportToExcel(products, filePath); var pageLink = DiskStorage.GetHccAdminUrl(HccApp, "catalog/default.aspx", false); var mailMessage = new MailMessage(conf.DnnPortalSettings.Email, HccApp.CurrentCustomer.Email); mailMessage.IsBodyHtml = true; mailMessage.Body = Localization.GetFormattedString("ExportProductsMailBody", pageLink); mailMessage.Subject = Localization.GetString("ExportProductsMailSubject"); MailServices.SendMail(mailMessage, HccApp.CurrentStore); } catch (Exception ex) { EventLog.LogEvent(ex); } }
protected void EmailPasswordToCustomer(OrderTaskContext context, CustomerAccount n) { try { var hccRequestContext = HccRequestContextUtils.GetContextWithCulture(context.RequestContext, context.Order.UsedCulture); var contentService = Factory.CreateService <ContentService>(hccRequestContext); var t = context.HccApp.ContentServices.GetHtmlTemplateOrDefault(HtmlTemplateType.ForgotPassword); if (t != null) { var replacers = new List <IReplaceable>(); replacers.Add(n); replacers.Add(new Replaceable("[[NewPassword]]", n.Password)); t = t.ReplaceTagsInTemplate(hccRequestContext, replacers); var m = t.ConvertToMailMessage(n.Email); if (!MailServices.SendMail(m, hccRequestContext.CurrentStore)) { EventLog.LogEvent("Create Account During Checkout", "Failed to send email to new customer " + n.Email, EventLogSeverity.Warning); } } } catch (Exception ex) { EventLog.LogEvent(ex); } }
public override bool Execute(OrderTaskContext context) { var u = context.HccApp.MembershipServices.Customers.FindByEmail(context.Order.UserEmail).FirstOrDefault(); if (u != null) { if (u.Bvin != string.Empty) { context.UserId = u.Bvin; return(true); } } var n = new CustomerAccount(); n.Email = context.Order.UserEmail; var length = WebAppSettings.PasswordMinimumLength; if (length < 8) { length = 8; } var newPassword = PasswordGenerator.GeneratePassword(length); n.Password = newPassword; n.FirstName = context.Order.ShippingAddress.FirstName; n.LastName = context.Order.ShippingAddress.LastName; if (context.HccApp.MembershipServices.CreateCustomer(n, n.Password)) { // Update Addresses for Customer context.Order.BillingAddress.CopyTo(n.BillingAddress); context.Order.ShippingAddress.CopyTo(n.ShippingAddress); context.HccApp.MembershipServices.UpdateCustomer(n); context.Order.CustomProperties.Add("hcc", "allowpasswordreset", "1"); // Email Password to Customer var hccRequestContext = HccRequestContextUtils.GetContextWithCulture(context.RequestContext, context.Order.UsedCulture); var contentService = Factory.CreateService <ContentService>(hccRequestContext); var t = contentService.GetHtmlTemplateOrDefault(HtmlTemplateType.ForgotPassword); if (t != null) { var replacers = new List <IReplaceable>(); replacers.Add(n); replacers.Add(new Replaceable("[[NewPassword]]", newPassword)); t = t.ReplaceTagsInTemplate(hccRequestContext, replacers); var m = t.ConvertToMailMessage(n.Email); if (!MailServices.SendMail(m, hccRequestContext.CurrentStore)) { EventLog.LogEvent("Create Account During Checkout", "Failed to send email to new customer " + n.Email, EventLogSeverity.Warning); } } } context.UserId = n.Bvin; return(true); }
protected string RenderCustomerMailToLink(IDataItemContainer cont) { var o = cont.DataItem as OrderSnapshot; return(MailServices.MailToLink(o.UserEmail, "Order " + o.OrderNumber, o.BillingAddress.FirstName + ",", o.BillingAddress.FirstName + " " + o.BillingAddress.LastName)); }
/// <summary> /// Update data into MailServices table /// </summary> /// <param name="DSObject">MailServices object</param> /// <returns></returns> public Object UpdateData(MailServices MSObject) { Object Update; try { //System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["VitalSignsConnectionString"].ToString()); //System.Data.SqlClient.SqlCommand com = new System.Data.SqlClient.SqlCommand("select max(serverID) from MailServices", con); //con.Open(); //object Maxserverid = com.ExecuteScalar(); //string maxid=Maxserverid.ToString(); //con.Close(); //if (maxid != "") //{ // if (int.Parse(maxid) > MSObject.ID) // { string SqlQuery = "UPDATE MailServices SET Address='" + MSObject.Address + "',Name='" + MSObject.Name + "',Description='" + MSObject.Description + "',Category='" + MSObject.Category + "',ScanInterval=" + MSObject.ScanInterval + ",OffHoursScanInterval=" + MSObject.OffHoursScanInterval + ",Enabled='" + MSObject.Enabled + "',ResponseThreshold=" + MSObject.ResponseThreshold + ", RetryInterval=" + MSObject.RetryInterval + ",Port=" + MSObject.Port + ",FailureThreshold=" + MSObject.FailureThreshold + ",LocationId=" + MSObject.LocationId + " WHERE [Key] = " + MSObject.key + ""; Update = objAdaptor.ExecuteNonQuery(SqlQuery); //} //else //{ // string SqlQuery = "INSERT INTO MailServices (ServerID,Address,Name,Description,Category,ScanInterval,OffHoursScanInterval" + // ",Enabled,ResponseThreshold,RetryInterval,Port,FailureThreshold)" + // "VALUES(" + MSObject.ID + ",'" + MSObject.Address + "','" + MSObject.Name + // "','" + MSObject.Description + "','" + MSObject.Category + // "'," + MSObject.ScanInterval + "," + MSObject.OffHoursScanInterval + // ",'" + MSObject.Enabled + "'," + MSObject.ResponseThreshold + "," + MSObject.RetryInterval + // "," + MSObject.Port + "," + MSObject.FailureThreshold + ")"; // Update = objAdaptor.ExecuteNonQuery(SqlQuery); //} //} //else //{ // string SqlQuery = "INSERT INTO MailServices (ServerID,Address,Name,Description,Category,ScanInterval,OffHoursScanInterval" + // ",Enabled,ResponseThreshold,RetryInterval,Port,FailureThreshold)" + // "VALUES(" + MSObject.ID + ",'" + MSObject.Address + "','" + MSObject.Name + // "','" + MSObject.Description + "','" + MSObject.Category + // "'," + MSObject.ScanInterval + "," + MSObject.OffHoursScanInterval + // ",'" + MSObject.Enabled + "'," + MSObject.ResponseThreshold + "," + MSObject.RetryInterval + // "," + MSObject.Port + "," + MSObject.FailureThreshold + ")"; // Update = objAdaptor.ExecuteNonQuery(SqlQuery); //} } catch { Update = false; } finally { } return(Update); }
public override bool Execute(OrderTaskContext context) { CustomerAccount u = context.MTApp.MembershipServices.Customers.FindByEmail(context.Order.UserEmail); if (u != null) { if (u.Bvin != string.Empty) { return(true); } } CustomerAccount n = new CustomerAccount(); n.Email = context.Order.UserEmail; int length = WebAppSettings.PasswordMinimumLength; if (length < 8) { length = 8; } string newPassword = MerchantTribe.Web.PasswordGenerator.GeneratePassword(length); n.Password = newPassword; n.FirstName = context.Order.ShippingAddress.FirstName; n.LastName = context.Order.ShippingAddress.LastName; if (context.MTApp.MembershipServices.CreateCustomer(n, n.Password)) { // Update Addresses for Customer context.Order.BillingAddress.CopyTo(n.BillingAddress); context.Order.ShippingAddress.CopyTo(n.ShippingAddress); context.MTApp.MembershipServices.UpdateCustomer(n); context.Order.CustomProperties.Add("bvsoftware", "allowpasswordreset", "1"); // Email Password to Customer HtmlTemplate t = context.MTApp.ContentServices.GetHtmlTemplateOrDefault(HtmlTemplateType.ForgotPassword); if (t != null) { System.Net.Mail.MailMessage m; List <IReplaceable> replacers = new List <IReplaceable>(); replacers.Add(n); replacers.Add(new Replaceable("[[NewPassword]]", newPassword)); t = t.ReplaceTagsInTemplate(context.MTApp, replacers); m = t.ConvertToMailMessage(n.Email); if (MailServices.SendMail(m, context.MTApp.CurrentStore) == false) { EventLog.LogEvent("Create Account During Checkout", "Failed to send email to new customer " + n.Email, EventLogSeverity.Warning); } } } context.UserId = n.Bvin; return(true); }
protected string RenderCustomerMailToLink(IDataItemContainer cont) { var o = cont.DataItem as OrderSnapshot; return(MailServices.MailToLink(o.UserEmail, string.Format(Localization.GetString("OrderSubject"), o.OrderNumber), string.Concat(o.BillingAddress.FirstName, ","), string.Concat(o.BillingAddress.FirstName, " ", o.BillingAddress.LastName))); }
// To Check Unique IPAddress public DataTable GetIPAddress(MailServices MailObj) { try { return(VSWebDAL.ConfiguratorDAL.MailServicesDAL.Ins.GetIPAddress(MailObj)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Call DAL Delete Data /// </summary> /// <param name="MSObject"></param> /// <returns></returns> public Object DeleteData(MailServices MSObject) { try { return(VSWebDAL.ConfiguratorDAL.MailServicesDAL.Ins.DeleteData(MSObject)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Call to Insert Data into MailServices /// </summary> /// <param name="MailServicesObject">MailServices object</param> /// <returns></returns> public bool InsertData(MailServices MailServicesObject) { try { return(VSWebDAL.ConfiguratorDAL.MailServicesDAL.Ins.InsertData(MailServicesObject)); } catch (Exception ex) { throw ex; } }
protected void btnSend_Click(object sender, System.Web.UI.ImageClickEventArgs e) { string requestedDomain = this.RequestedDomain.Text; string ownsDomain = this.lstOwnAlready.SelectedItem.Text; string hasSSL = this.lstHaveSSL.SelectedItem.Text; string contactEmail = this.ContactEmail.Text; string contactPhone = this.ContactPhone.Text; string contactName = this.ContactName.Text; MailServices.SendCustomDomainRequest(contactName, contactEmail, contactPhone, requestedDomain, ownsDomain, hasSSL); this.MessageBox1.ShowOk("Domain Request Sent! Thank you. We'll be in touch soon."); }
public HttpResponseMessage send(EmailInsertRequest model) { if (!ModelState.IsValid || model == null) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } EmailInsertRequest response = new EmailInsertRequest(); response = MailServices.send(model); return(Request.CreateResponse(HttpStatusCode.OK)); }
/// <summary> /// Use this method to send an email to the merchant about the low stock level. /// </summary> /// <param name="recipientEmail">String - the email address where to send the low stock report to</param> /// <param name="storeName">String - the name of the store to use for the email template</param> /// <param name="app">An active instance of HotcakesApplication, used to access store settings.</param> /// <returns>If true, the email was sent successfully using the given parameters.</returns> public static bool EmailLowStockReport(string recipientEmail, string storeName, HotcakesApplication app) { var result = false; try { var fromAddress = string.Empty; fromAddress = recipientEmail; var m = new MailMessage(fromAddress, recipientEmail); m.IsBodyHtml = false; m.Subject = "Low Stock Report From " + storeName; var sb = new StringBuilder(); sb.AppendLine("The following are low in stock or out of stock:"); sb.Append(Environment.NewLine); var inventories = app.CatalogServices.ProductInventories.FindAllLowStock(); if (inventories.Count < 1) { sb.Append("No out of stock items found."); } else { foreach (var item in inventories) { var product = app.CatalogServices.Products.Find(item.ProductBvin); if (product != null) { sb.Append(WebAppSettings.InventoryLowReportLinePrefix); sb.Append(product.Sku); sb.Append(", "); sb.Append(product.ProductName); sb.Append(", "); sb.Append(item.QuantityOnHand); sb.AppendLine(" "); } } } m.Body = sb.ToString(); result = MailServices.SendMail(m, app.CurrentStore); } catch (Exception ex) { EventLog.LogEvent(ex); result = false; } return(result); }
private void InsertMailServices() { MailServices mailObj = new MailServices(); mailObj.Address = AddressTextBox.Text; mailObj.Name = MSNameTextBox.Text; mailObj.key = ServerKey; DataTable returntable = VSWebBL.ConfiguratorBL.MailServicesBL.Ins.GetIPAddress(mailObj); if (returntable.Rows.Count > 0) { //3/19/2014 NS modified //ErrorMessageLabel.Text = "This Mail Service Name/IP Address or host name is already being monitored. Please enter a different IP Address/Name."; //ErrorMessagePopupControl.ShowOnPageLoad = true; errorDiv.Style.Value = "display: block"; //10/3/2014 NS modified for VSPLUS-990 errorDiv.InnerHtml = "The Mail Service Name/IP Address or host name you entered is already being monitored. Please enter a different IP Address/Name." + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; flag = true; } else { try { object ReturnValue = VSWebBL.ConfiguratorBL.MailServicesBL.Ins.InsertData(CollectDataForMailServices()); SetFocusOnError(ReturnValue); if (ReturnValue.ToString() == "True") { //3/19/2014 NS modified /* * ErrorMessageLabel.Text = "New mail service created successfully."; * ErrorMessagePopupControl.HeaderText = "Information"; * ErrorMessagePopupControl.ShowCloseButton = false; * ValidationUpdatedButton.Visible = true; * ValidationOkButton.Visible = false; * ErrorMessagePopupControl.ShowOnPageLoad = true; */ Session["MailServiceUpdateStatus"] = MSNameTextBox.Text; Response.Redirect("MailServicesGrid.aspx", false);//Mukund, 05Aug14, VSPLUS-844:Page redirect on callback Context.ApplicationInstance.CompleteRequest(); } } catch (Exception ex) { //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } } }
public override bool Execute(OrderTaskContext context) { string toEmail = null; HtmlTemplate template = null; var culture = "en-US"; switch (_emailTo) { case "Admin": toEmail = context.HccApp.CurrentStore.Settings.MailServer.EmailForNewOrder; var storeSettingsProvider = Factory.CreateStoreSettingsProvider(); culture = storeSettingsProvider.GetDefaultLocale(); break; case "Customer": toEmail = context.Order.UserEmail; culture = context.Order.UsedCulture; break; } var hccRequestContext = HccRequestContextUtils.GetContextWithCulture(context.RequestContext, culture); var contentService = Factory.CreateService <ContentService>(hccRequestContext); switch (_emailTo) { case "Admin": template = contentService.GetHtmlTemplateOrDefault(HtmlTemplateType.NewOrderForAdmin); break; case "Customer": template = contentService.GetHtmlTemplateOrDefault(HtmlTemplateType.NewOrder); break; } try { if (!string.IsNullOrEmpty(toEmail)) { template = template.ReplaceTagsInTemplateForOrder(hccRequestContext, context.Order); var m = template.ConvertToMailMessage(toEmail); MailServices.SendMail(m, hccRequestContext.CurrentStore); } } catch (Exception ex) { EventLog.LogEvent(ex); } return(true); }
/// <summary> /// Evia o alerta de lançamento em atraso para todos os usuários /// </summary> /// <param name="email">boolean - se vai receber por e-mail ou não</param> /// <param name="sms">boolean - se vai receber por sms ou não</param> /// <param name="telegram">boolean - se vai receber por telegram ou não</param> /// <returns></returns> public virtual void EnviarTodosOsAlertas(bool email = true, bool sms = false) { var modelo = this.GetUsuariosComAtrasoNoEnvio(); if ((modelo == null) || (modelo.Count == 0)) { throw new Exception("O usuário não foi encontrado"); } bool erro = false; string mensagens = ""; foreach (var x in modelo) { try { if (email) { MailServices.Enviar(x.Usuario.EmailPreferencial, "Faz tempo que você não lança suas atividades", string.Format("Detectamos que faz {0} dias que você não lança suas atividades. Por favor lance hoje.", x.DiasUteisSemLancar)); } } catch (Exception err) { erro = true; mensagens += "Ocorreu um erro ao enviar o alerta via e-mail para " + x.Usuario.Login + ": " + err.Message + "<br/>\r\n"; LogServices.LogarException(err); } string smsResult = ""; try { if (sms && x.Usuario.Funcionario != null && !string.IsNullOrWhiteSpace(x.Usuario.Funcionario.Celular)) { smsResult = SMSServices.Enviar(x.Usuario.Funcionario.Celular, x.Usuario.FuncionarioNomeOuLogin, "Faz tempo que você não lança suas atividades", string.Format("Detectamos que faz {0} dias que você não lança suas atividades. Por favor lance hoje.", x.DiasUteisSemLancar)); LogServices.Logar(smsResult); } } catch (Exception err) { erro = true; mensagens += "Ocorreu um erro ao enviar o alerta via sms para " + x.Usuario.Login + ": " + err.Message + "<br/>\r\n"; LogServices.LogarException(err); } } if (erro) { throw new Exception("Erros ocorridos: " + mensagens); } }
public ApiBoolResponseDTO SendEmailTest() { var mail = new MailServices { Subject = "Test Message", Body = "Email Notifications Are Working!", MailTo = SettingServices.GetSettingValue(SettingStrings.SmtpMailTo) }; mail.Send(); return(new ApiBoolResponseDTO { Value = true }); }
public void SendGiftCardNotification(GiftCard giftCard, Order order, LineItem item) { var usedCulture = order != null ? order.UsedCulture : "en-US"; var hccRequestContext = HccRequestContextUtils.GetContextWithCulture(Context, usedCulture); var contentService = Factory.CreateService <ContentService>(hccRequestContext); var template = GetHtmlTemplateOrDefault(HtmlTemplateType.GiftCardNotification); template = template.ReplaceTagsInTemplate(hccRequestContext, new List <IReplaceable> { item, giftCard }); var message = template.ConvertToMailMessage(giftCard.RecipientEmail); MailServices.SendMail(message, hccRequestContext.CurrentStore); }
private void SendMailInvitation(string email) { MailServices MailServ = new MailServices(); ITemplate factory = new TemplateMessagesFactory(); CompanyServices csrv = new CompanyServices(); var company = csrv.Get(new CompanyModel() { CompanyId = UserCompanyId }).FirstOrDefault(); Dictionary <string, string[]> parsm = new Dictionary <string, string[]>(); parsm.Add("{Enfasis}", new string[] { company.CompanyName }); MailServ.SendMail(factory.GetTemplate(email, "InvitationCompany", parsm)); }
public void SendAffiliateReviewEmail(Affiliate aff) { var storeSettingsProvider = Factory.CreateStoreSettingsProvider(); var defaultCulture = storeSettingsProvider.GetDefaultLocale(); var hccRequestContext = HccRequestContextUtils.GetContextWithCulture(Context, defaultCulture); var contentService = Factory.CreateService <ContentService>(hccRequestContext); var template = contentService.GetHtmlTemplateOrDefault(HtmlTemplateType.AffiliateReview); template = template.ReplaceTagsInTemplate(hccRequestContext, aff); var storeAdmin = hccRequestContext.CurrentStore.Settings.MailServer.EmailForNewOrder; var message = template.ConvertToMailMessage(storeAdmin); MailServices.SendMail(message, hccRequestContext.CurrentStore); }
/// <summary> /// Main /// Publisher and Subscribers /// Timer /// </summary> /// <param name="args"></param> public static void Main(string[] args) { var alarm = new Alarm() { Name = "Server crash" }; var countdown = new Countdown(); var mailServices = new MailServices(); var emailServices = new EmailServices(); var msgServices = new MsgServices(); countdown.EventIsUp += mailServices.OnEventIsUp; countdown.EventIsUp += emailServices.OnEventIsUp; countdown.EventIsUp += msgServices.OnEventIsUp; countdown.TimeCounter(alarm); }
public async Task <ActionResult> SendPromemoria(int Id) { var abbonamento = await _context.Abbonamenti.FindAsync(Id); var mailTo = _context.Utenti.Find(abbonamento.UtenteId).Mail; MailServices mail = new MailServices(); if (mail.SendPromemoria(mailTo, abbonamento.FineAbbonamento.ToShortDateString())) { return(Json(new { status = "success" })); } else { return(Json(new { status = "error" })); } }
protected void btnSendStatusEmail_Click(object sender, EventArgs e) { long templateId = 0; long.TryParse(lstEmailTemplate.SelectedValue, out templateId); var t = HccApp.ContentServices.HtmlTemplates.Find(templateId); if (t == null) { return; } var toEmail = CurrentOrder.UserEmail; var culture = CurrentOrder.UsedCulture; if (t.TemplateType == HtmlTemplateType.NewOrderForAdmin || t.TemplateType == HtmlTemplateType.DropShippingNotice || t.TemplateType == HtmlTemplateType.ContactFormToAdmin) { toEmail = HccApp.CurrentStore.Settings.MailServer.EmailForNewOrder; var storeSettingsProvider = Factory.CreateStoreSettingsProvider(); culture = storeSettingsProvider.GetDefaultLocale(); } var hccRequestContext = HccRequestContextUtils.GetContextWithCulture(HccRequestContext.Current, culture); var contentService = Factory.CreateService <ContentService>(hccRequestContext); if (!string.IsNullOrWhiteSpace(toEmail)) { // this time get template in correct culture t = contentService.HtmlTemplates.Find(templateId); t = t.ReplaceTagsInTemplateForOrder(hccRequestContext, CurrentOrder); var m = t.ConvertToMailMessage(toEmail); if (MailServices.SendMail(m, hccRequestContext.CurrentStore)) { ucMessageBox.ShowOk("E-Mail Sent!"); } else { ucMessageBox.ShowError("Message Send Failed."); } } LoadOrder(); }