public ActionResult contactUs(ContactUs model) { try { if (ModelState.IsValid) { using (NotesMarketPlaceEntities DBobj = new NotesMarketPlaceEntities()) { ContactUs u = new ContactUs(); u.FullName = model.FullName; u.EmailAddress = model.EmailAddress; u.Subject = model.Subject; u.Comments = model.Comments; u.CreatedDate = DateTime.Now; u.IsActive = true; DBobj.ContactUs.Add(u); DBobj.SaveChanges(); if (u.ContactID > 0) { ModelState.Clear(); ContactUsEmail.ContactUs(model.Subject, model.FullName, model.Comments); return(View()); } } } return(View()); } catch (Exception e) { return(View()); } }
public void EnterContactUsDetail() { ContactUsTab.Click(); ContactUsName.SendKeys("test1"); ContactUsEmail.SendKeys("*****@*****.**"); ContactUs_Form_Subject.SendKeys("Test Subject"); ContactUs_Form_Message.SendKeys("Test message for Contact us form"); ContactUs_Form_Send.Submit(); }
public ActionResult Contact([Bind(Include = "SenderFistName,SenderLastName,From,EmailSubject,EmailBody")] ContactUsEmail model) { if (!ModelState.IsValid) { return(View(model)); } model.To = "*****@*****.**"; PostalEmailManager.SendContactUsEmail(model); Response.Cookies.Add(new HttpCookie("successCookie", "Action is completed successfully")); //remove MessageSent view fom home return(RedirectToAction("Index")); }
public void TestEncodingContents() { // Send. var communication = new ContactUsEmail(From, Name, UserType.Employer, PhoneNumber, null, RequiresEncodingContent); _emailsCommand.TrySend(communication); // Check. var email = _emailServer.AssertEmailSent(); email.AssertAddresses(new EmailRecipient(From, Name), Return, ClientServicesInbox); email.AssertSubject(GetSubject(From, UserType.Employer)); email.AssertHtmlViewChecks(); email.AssertHtmlView(GetBody(communication, GetContent(Name, PhoneNumber, EnquiryType, From, RequiresEncodingContent))); email.AssertNoAttachments(); AssertCompatibleAddresses(email); }
public async Task <IActionResult> SendContactUsEmail(ContactUsEmail email) { await _emailSender.SendEmailAsync(email.Email, email.Subject, $"<p>{email.Message}</p>"); return(Ok()); }