Exemplo n.º 1
0
        public ActionResult Contact(Mail model)
        {
            if (ModelState.IsValid)
            {
                MailMessage m = new MailMessage("*****@*****.**", "*****@*****.**");
              // m.Subject=model.Subject;
               string poruka = "Ime: " + model.Name + " Email: " + model.Email + " Telefon: " + model.Phone + " Poruka: " + model.Message;
                m.Body = poruka;
               m.IsBodyHtml = true;
               SmtpClient s = new SmtpClient("smtp.gmail.com",587);
                s.Credentials = new System.Net.NetworkCredential()
                { UserName="******",
                 Password="******"
                };

                s.EnableSsl=true;
                s.Send(m);
                ViewBag.Message = "Email poslan!";
                Response.Write("Email poslan!");

            }
            return View(model);
        }
Exemplo n.º 2
0
 public ActionResult Contact()
 {
     ViewBag.Message = "Your contact page.";
     var model = new Mail();
     return View(model);
 }