public ActionResult SaveContactUs(tblContactDetails tbl) { Error obje = new Error(); bool test = objUser.Save(tbl); obje.ErrorMessage = SettingsHelper.SendMail(tbl.MailId, tbl.Name, true); return(Json(obje, JsonRequestBehavior.AllowGet)); }
internal void Delete(int id) { tblContactDetails tbl = (from c in objData.tblContactDetailss where c.ContactUsId == id select c).FirstOrDefault(); if (tbl != null) { objData.tblContactDetailss.Remove(tbl); objData.SaveChanges(); } }
public ActionResult Reply(tblContactDetails model) { SettingsHelper.SendMail(model); return(Json(true, JsonRequestBehavior.AllowGet)); }
public static void SendMail(tblContactDetails model) { try { //System.Web.Mail.MailMessage message = new System.Web.Mail.MailMessage(); //string fromEmail = "*****@*****.**"; //string fromPW = "varmala753"; //string toEmail = model.MailId; //const string SERVER = "relay-hosting.secureserver.net"; //System.Web.Mail.MailMessage oMail = new System.Web.Mail.MailMessage(); //oMail.From = fromEmail; //oMail.To = toEmail; ////oMail.Subject = "Complete Profile"; //oMail.Subject = model.Name; StringBuilder sb = new StringBuilder(); sb.Append("<html><head></head><body><div><span>Hello ,</span><br/><span>Welcome to Varmalavivah.com.</span><br />"); sb.Append("<span>" + model.Description + "</span><br/>"); sb.Append("<span>Please do login with your registered mail id.</span><br/>"); sb.Append("<span>For matrimonial assistance,</span><br/>"); sb.Append("<span>Call us at 8806369038</span><br />"); sb.Append("<span>Timing: 10:00 am – 6:00pm(Monday to Saturday).Share your feedback with any query or comments on [email protected].</span><br />"); sb.Append("<span>Best Regards</span><br/>"); sb.Append("<span>varmalavivah.com</span>"); sb.Append("<br/>Sent at: " + DateTime.Now); sb.Append("<div></body></html>"); ////oMail.Body = //oMail.BodyFormat = System.Web.Mail.MailFormat.Html; // enumeration //oMail.Priority = System.Web.Mail.MailPriority.High; // enumeration //oMail.Body = sb.ToString(); //System.Web.Mail.SmtpMail.SmtpServer = SERVER; //System.Web.Mail.SmtpMail.Send(oMail); System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); string fromEmail = "*****@*****.**"; string fromPW = "Ganesh0511@"; string toEmail = "*****@*****.**"; message.From = new System.Net.Mail.MailAddress(fromEmail); message.To.Add(toEmail); message.Subject = "Hello"; message.Body = sb.ToString(); message.DeliveryNotificationOptions = System.Net.Mail.DeliveryNotificationOptions.OnFailure; using (System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient("mail.varmalavivah.com", 25)) { smtpClient.EnableSsl = false; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; //smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = new System.Net.NetworkCredential(fromEmail, fromPW); smtpClient.Send(message.From.ToString(), message.To.ToString(), message.Subject, message.Body); } //oMail = null; // free up resources } catch (Exception ex) { } }