public static object SendMessage(string fname, string email, string phone, string comments) { var mail = new SendEmail(); var _body = new contact_us().CreateEmailStr(fname, email, phone, comments); var checkSent = mail.SendAnEmail(email, "*****@*****.**", Resources.Resource_ar.FeedbackHeader, _body); //mail.SendNow(email, "*****@*****.**", Resources.Resource_ar.FeedbackHeader, _body); object obj = new { }; if (checkSent) { obj = new { status = true, message = Resources.Resource_ar.EmailSent }; } else { obj = new { status = false, message = Resources.Resource_ar.EmailSendingError }; } return(obj); }
public JsonResult SaveContactDetails(string name, string email, string mobile, string message) { string result = "Your request can not process!"; contact_us contact = new contact_us(); contact.name = name; contact.email = email; contact.mobile = mobile; contact.message = message; m_db.contact_us.Add(contact); contact.date_of_creation = DateTime.Now; m_db.SaveChanges(); SendMail cf = new SendMail(); string mail = "Dear " + name + ",<br/><br/>Thanks for writting to us.We will contact you as soon as possible.<br/><br/><br/> With Regards, <br/> Team IBS"; string[] send_to = new string[] { email }; string[] bcc_to = new string[] { "" }; string subject = "Regarding IBS Query"; byte[] bytes = null; result += cf.send_mail(mail, send_to, bcc_to, subject, bytes, ""); result = "Thanks for contacting us."; return(Json(result, JsonRequestBehavior.AllowGet)); }