Example #1
0
        public ActionResult Contact(ddvi_FormLog formlog)
        {
            try
            {

                ViewData["MessageType"] =
                    new SelectList(new[] { "Select a Subject", "Request for Proposal", "Request for Information", "Need a Quote", "Other" }
                    .Select(x => new { value = x, text = x }), "value", "text", "Select a Subject");

                MailAddress from = new MailAddress(formlog.Email,formlog.FName + " " + formlog.LastName);
                MailAddress to = new MailAddress("*****@*****.**", "David Sanchez");
                MailMessage message = new MailMessage(from, to);
                message.IsBodyHtml = true;
                message.Body = "<font color=#000000 face=Arial>Name: " + formlog.FName + " " + formlog.LastName + "<br/>";
                message.Body += formlog.MessageType + "<br/>";
                message.Body += formlog.Message + "<br/>";
                message.Body += "</font><br/><font color=#F89292 face=Arial><b>* Do not reply to this message. This is a web application message.</b></font>";
                message.Subject = formlog.MessageType;
                message.SubjectEncoding = System.Text.Encoding.UTF8;

                message.BodyEncoding = System.Text.Encoding.UTF8;

                SmtpClient client = new SmtpClient("relay-hosting.secureserver.net");
                //client.Credentials.GetCredential();
            //    client.Host = "relay-hosting.secureserver.net";
            //    client.Port = 25;

                try
                {
                    client.Send(message);
                    //SendCompleted;
                    _repository.Add(formlog);
                    _repository.Save();

                }
                catch(Exception ex)
                {
                    Response.Write(ex);

                }

                return RedirectToAction("Contact");
            }
            catch
            {
                return View();
            }
        }
Example #2
0
 partial void Deleteddvi_FormLog(ddvi_FormLog instance);
Example #3
0
 partial void Updateddvi_FormLog(ddvi_FormLog instance);
Example #4
0
 partial void Insertddvi_FormLog(ddvi_FormLog instance);
Example #5
0
 // [AcceptVerbs(HttpVerbs.Post)]
 public ActionResult Create(ddvi_FormLog formlog)
 {
     try
     {
         _repository.Add(formlog);
         _repository.Save();
         return RedirectToAction("Contact");
     }
     catch
     {
         return View();
     }
 }
Example #6
0
 public void Add(ddvi_FormLog formlog)
 {
     _dataContext.ddvi_FormLogs.InsertOnSubmit(formlog);
 }