public ActionResult Create(EmailViewModel model) { if (ModelState.IsValid) { string smtpUserName = "******"; string smtpPassword = "******"; string smtpHost = "smtp.mail.ru"; int smtpPort = 2525; string emailTo = model.EmailTo; string subject = model.Subject; StreamReader reader = new StreamReader(Server.MapPath("~/Views/SendEmail/MessageBody.html")); string bodyHtml = reader.ReadToEnd(); string body = string.Format("Hello,<b>{0} sended invit for you!</b><br/>Email:{1}<br/>" + "Channel name:<strong> {3}</strong><br/>" + "For join fill the channel name field and click the button.</br><br/>{2}</br>" + bodyHtml, model.UserName, model.EmailFrom, model.Message, model.Channel.Name); EmailServices serv = new EmailServices(); bool kq = serv.Send(smtpUserName, smtpPassword, smtpHost, smtpPort, emailTo, subject, body); if (kq) { ModelState.AddModelError("", "Sended"); } else { ModelState.AddModelError("", "Not sended"); } } return(View(model)); }
public string AdicionarCliente(Client cliente) { if (!cliente.IsValid()) { return("Dados inválidos"); } var repo = new ClientRepository(); repo.InsertClient(cliente); EmailServices.Send("*****@*****.**", cliente.Email, "Bem Vindo", "Parabéns está Cadastrado"); return("Cliente cadastrado com sucesso"); }
public string Add(Client client) { if (!client.Validate()) { return("Invalid data"); } var clientRepository = new ClientRepository(); clientRepository.Add(client); EmailServices.Send("*****@*****.**", client.Email.Address, "Welcome!", "You're now registered"); return("User registered successfully"); }
public string AddClient(Client client) { if (!client.IsValid()) { return("Invalid data"); } var repo = new ClientRepository(); repo.AddClient(client); EmailServices.Send("*****@*****.**", client.Email, "Welcome", "Congratulations!!!"); return("Client ok"); }
public string AddCustomer(Customer customer) { if (!customer.Validate()) { return("Invalid data"); } var customerRepository = new CustomerRepository(); customerRepository.AddCustomer(customer); EmailServices.Send( "*****@*****.**", customer.Email.Address, "Welcome", "Congratulations are registered" ); return("Customer successfully registered"); }
public string Add(Client client) { if (!client.IsValid()) { return(Properties.Resources.InvalidClient); } var clientRepository = new ClientRepository(); clientRepository.Add(client); EmailServices.Send( "*****@*****.**", client.Email, Properties.Resources.ClientWelcome, Properties.Resources.CongratulationsRegister); return(string.Format(Properties.Resources.AddClientSuccess, client.Name)); }