public void SendEmailWhileUploadAgreement(Guid id) { var order = _companyOrderRepository.GetById(id); foreach (var item in order.Company.MembershipUsers) { if (item.EmailTaskTypes.FirstOrDefault(x => x.Id == 29) != null) { string emailBody = string.Empty; var minOrderDate = order.SubOrders.OrderBy(x => x.StartDate).FirstOrDefault().StartDate; var maxOrderDate = order.SubOrders.OrderBy(x => x.StartDate).LastOrDefault().StartDate; if (maxOrderDate > minOrderDate) { emailBody = string.Format(AGREEMENTChANGED_EMAIL_FORMATTER, Convert.ToDateTime(minOrderDate).ToString("yyyy-MM-dd") + "~" + Convert.ToDateTime(maxOrderDate).ToString("yyyy-MM-dd")); } else { emailBody = string.Format(AGREEMENTChANGED_EMAIL_FORMATTER, Convert.ToDateTime(minOrderDate).ToString("yyyy-MM-dd")); } var email = new Email { To = item.Email, ToName = order.Company.CompanyName, Body = string.Format(EmailBodyFormatter.EnterpriseBody, emailBody) }; _emailService.Add(email); } } }
// Post: Admin/Tag/Add/id public virtual ActionResult Add(EmailAdd model) { if (!ModelState.IsValid) { return(View(model)); } string[] emails; bool result; if (!string.IsNullOrEmpty(Request["Emails[]"])) { emails = Request["Emails[]"].Split(','); foreach (string email in emails) { result = Utilities.Email.MailSender.SendMail(model.Title, model.Body, email); if (result) { _emailService.Add(new Email { Title = model.Title, Body = model.Body, SendTime = DateTime.Now, EmailAddress = email }); } } } _uow.SaveAllChanges(); return(RedirectToAction("Index")); }
public ActionResult SendMail(Contact contact) { var mail = new Email { Title = contact.Title, Content = contact.Content, EmailDate = DateTime.Now, UserEmail = contact.UserEmail, }; _emailService.Add(mail); MailMessage mailMessage = new MailMessage(); mailMessage.To.Add(mail.UserEmail); mailMessage.From = new MailAddress("*****@*****.**"); mailMessage.Subject = mail.Title; mailMessage.Body = "Sayın" + " " + contact.UserName + "," + "<br>" + mail.Content; mailMessage.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Credentials = new NetworkCredential("*****@*****.**", "Cankan94"); smtp.Port = 587; smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; smtp.Send(mailMessage); return(RedirectToAction("SentMessages")); }
private void btnAddEmail_Click(object sender, EventArgs e) { Email email = new Email { UserId = _user.UserId, EmailName = tbxEditEmail.Text }; ControllingException(() => _emailService.Add(email)); LoadEmails(); }
/// <summary> /// Method to insert/save email record /// </summary> /// <param name="email">email records to be inserted/saved</param> /// <returns></returns> public HttpResponseMessage Post(Email email) { if (true)//TODO: replace this with validation logic ModelState.IsValid { _emailService.Add(email); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, email); response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = email.Id })); return(response); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
public JsonResult BilgilendirmeMail(string email) { Email Email; Email = emailService.Get(x => x.EmailAddress.Equals(email) && x.WebSiteid == CurrentWebsite.id); if (Email == null) { bool IsValid = RegexUtilities.IsValidEmail(email); if (IsValid) { emailService.Add(new Email() { EmailAddress = email, WebSite = CurrentWebsite }); emailService.Save(); return(Json("Başarılı bi şekilde abone oldunuz.")); } return(Json("Lütfen Mail Adresinizi Doğru bir Şekilde Giriniz")); } return(Json("Zaten Abonesiniz.")); }
public bool EmailAdd(Website Website, string email, string category) { bool status = false; if (emailService.Get(x => x.EmailAddress == email && x.WebSiteid == Website.id) == null) { status = true; emailService.Add(new Email() { EmailAddress = email, Category = category, WebSite = Website }); try { status = true; emailService.Save(); } catch (Exception) { status = false; throw; } } return(status); }
public async Task <IActionResult> Add([FromBody] AddEmailRequestModel model) { return(await MakeActionCallAsync(async() => await emailService.Add(model))); }