public ResponseModel SendTestEmail(TestEmailModel model) { var emailAccount = GetById(model.EmailAccountId); if (emailAccount == null) { return(new ResponseModel { Success = false, Message = T("EmailAccount_Message_ObjectNotFound") }); } var emailModel = new EmailModel { From = emailAccount.Email, FromName = "Email Test Service", To = model.Email, ToName = model.Email, Bcc = string.Empty, CC = string.Empty, Subject = "Test Email", Body = "This is test email.", Attachment = string.Empty }; return(SendEmailDirectly(emailAccount, emailModel)); }
public IHttpActionResult Email(TestEmailModel model) { var client = new EmailProvider(); client.SendMail(WebConfigurationManager.AppSettings["AppEmail"], model.Email, "Test", "Test email!"); return(Ok(new ApiResponse(200, new { Email = model.Email }))); }
public JsonResult SendTestEmail(TestEmailModel model) { if (ModelState.IsValid) { return(Json(_emailAccountServices.SendTestEmail(model))); } return(Json(new ResponseModel { Success = false, Message = GetFirstValidationResults(ModelState).Message })); }
public JsonResult SendTestEmail(TestEmailModel model) { if (ModelState.IsValid) { return(Json(_emailAccountService.SendTestEmail(model))); } return(Json(new ResponseModel { Success = false, Message = ModelState.BuildValidationMessages() })); }
public ActionResult TestEmail() { MembershipUser user = Membership.GetUser(User.Identity.Name); //var u = new UrlHelper(this.Request.RequestContext); //string host = this.Request.Url.Host; //string urlLeftPart = Request.Url.Scheme + Uri.SchemeDelimiter + host; var model = new TestEmailModel(); model.Url = Utility.GetSiteLogonUrl(this.Request); model.AbsoluteUri = this.Request.Url.AbsoluteUri; model.AbsolutePath = this.Request.Url.AbsolutePath; model.LocalPath = this.Request.Url.LocalPath; model.Authority = this.Request.Url.Authority; model.DnsSafeHost = this.Request.Url.DnsSafeHost; model.Host = this.Request.Url.Host; model.Email = user.Email; return(View(model)); }
public async Task <IActionResult> testemail(TestEmailModel model) { if (ModelState.IsValid) { var result = await _emailService.SendEmailAsync(new EmailMessage { EmailAddress = model.Email, Subject = $"Test message from {WebSiteOptions.WebSiteTitle}", Body = $"This is a test message from {WebSiteOptions.WebSiteTitle}.{Environment.NewLine}{Environment.NewLine}{model.Message}" }); if (result.Success) { AlertMessageCollection.AddSuccessAlert($"Email sent to {model.Email}\n{result.Details}", "Email Sent!"); } else { AlertMessageCollection.AddDangerAlert(result.Details, "Email Failure"); } } return(View()); }
public async Task <IActionResult> Test([FromBody] TestEmailModel model) { return(await SendMessageAsync(model.Message, model.Config)); }
public ResponseModel SendTestEmail(TestEmailModel model) { throw new NotImplementedException(); }