Good afternoon, I'm new to the forum, I do not understand programming much.
I would like some help to solve a problem on my form.
I am Brazilian then without abbreviations in the words kkkk
When I click on send it goes to a page of the site only with the form. could someone help me leave a written message successfully sent! and make it send to the email. Who can help me the site is
www.invistaemsuavida.com.br
The last button has a form below.
I thank you in advance. Many thanks from the heart.
HomeController
using invistaemsuavida1.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;
using System.Web.Mvc;
namespace invistaemsuavida1.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Livroinvista()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Livroempreender()
{
ViewBag.Message = "Your contact page.";
return View();
}
public ActionResult Livroanova()
{
ViewBag.Message = "Your contact page.";
return View();
}
public ActionResult FacaPedido()
{
return View();
}
[HttpPost]
public ActionResult PedidoLivro (FormPedidoLivro FormPedidoLivro)
{
MailMessage objEmail = new MailMessage();
objEmail.From = new MailAddress("pedidolivro@invistaemsuavida.com.br") ;
objEmail.To.Add(new MailAddress("pedidolivro@invistaemsuavida.com.br") );
//objEmail.CC.Add(new MailAddress("sistema@placasexpress.com"));
objEmail.Subject = "Pedido Livro";
objEmail.IsBodyHtml = true;
//Attachment attachFile = new Attachment(Attachment, "Orcamento.pdf", "application/pdf");
//objEmail.Attachments.Add(attachFile);
objEmail.Body = "Pedido do livro <br/><br>" +
"Nome: " + FormPedidoLivro.Nome + "<br/>" +
"Endereço: " + FormPedidoLivro.Endereco + "<br/>" +
"Cidade/Estado: " + FormPedidoLivro + "/" + FormPedidoLivro.Estado + "<br/>" +
"E-mail: " + FormPedidoLivro.Email + "<br/>" +
"Quantidade Desejada: " + FormPedidoLivro.QuantDesejada + "<br/>";
SmtpClient smtp = new SmtpClient("mail1.placasexpress.com");
smtp.Credentials = new System.Net.NetworkCredential("pedidolivro@invistae msuavida.com.br", "xxxxxxx");
smtp.Port = 587; smtp.EnableSsl = true;
smtp.Send(objEmail);
return View(ViewBag.Message = "Suas informações foram enviadas com sucesso.");
}
//EBOOK
public ActionResult PedidoEbook(FormPedidoEbook PedidoEbook)
{
MailMessage objEmail = new MailMessage();
objEmail.From = new MailAddress("pedidolivro@invistaemsuavida.com.br") ;
objEmail.To.Add(new MailAddress("pedidolivro@invistaemsuavida.com.br") );
//objEmail.CC.Add(new MailAddress("sistema@placasexpress.com"));
objEmail.Subject = "Pedido E-BOOK";
objEmail.IsBodyHtml = true;
//Attachment attachFile = new Attachment(Attachment, "Orcamento.pdf", "application/pdf");
//objEmail.Attachments.Add(attachFile);
objEmail.Body = "Pedido E-BOOK<br/><br>" +
"Nome: " + PedidoEbook.Nome + "<br/>" +
"Endereço: " + PedidoEbook.Endereco + "<br/>" +
"Cidade/Estado: " + PedidoEbook.Cidade + "/" + PedidoEbook.Estado + "<br/>" +
"E-mail: " + PedidoEbook.Email + "<br/>";
SmtpClient smtp = new SmtpClient("mail1.placasexpress.com");
smtp.Credentials = new System.Net.NetworkCredential("pedidolivro@invistae msuavida.com.br", "xxxxx");
smtp.Port = 587; smtp.EnableSsl = true;
smtp.Send(objEmail);
return View();
}
[HttpPost]
public ActionResult PedidoPDV(FormPedidoPDV FormPedidoPDV)
{
MailMessage objEmail = new MailMessage();
objEmail.From = new MailAddress("pedidolivro@invistaemsuavida.com.br") ;
objEmail.To.Add(new MailAddress("pedidolivro@invistaemsuavida.com.br") );
//objEmail.CC.Add(new MailAddress("sistema@placasexpress.com"));
objEmail.Subject = "Pedido PDV";
objEmail.IsBodyHtml = true;
//Attachment attachFile = new Attachment(Attachment, "Orcamento.pdf", "application/pdf");
//objEmail.Attachments.Add(attachFile);
objEmail.Body = "Pedido PDV<br/><br>" +
"Nome fantasia: " + FormPedidoPDV.NomeFantasia + "<br/>" +
"Nome do proprietário/comprador: " + FormPedidoPDV.NomePropriCompra + "<br/>" +
"Endereço: " + FormPedidoPDV.Endereco + "<br/>" +
"Cidade/Estado: " + FormPedidoPDV.Cidade + "/" + FormPedidoPDV.Estado + "<br/>" +
"E-mail: " + FormPedidoPDV.Email + "<br/>" +
"Fone: " + FormPedidoPDV.Telefone + "<br/>" +
"Ramo de atividade: " + FormPedidoPDV.RamoAtivi + "<br/>";
SmtpClient smtp = new SmtpClient("mail1.placasexpress.com");
smtp.Credentials = new System.Net.NetworkCredential("pedidolivro@invistae msuavida.com.br", "xxxxx");
smtp.Port = 587; smtp.EnableSsl = true;
smtp.Send(objEmail);
return View();
}
}
}
PedidoLivro.Cshtml
@model invistaemsuavida1.Models.FormPedidoLivro
@using (Html.BeginForm("PedidoLivro", "Home"))
{
<div class="row">
<div class="form-group">
@Html.ValidationMessageFor(a => a.Nome)
@Html.LabelFor(a => a.Nome)
@Html.TextBoxFor(a => a.Nome, new { @class = "form-control", placeholder = "Ex: Ricardo Jose da Silva Nunes" })
</div>
<div class="form-group">
@Html.ValidationMessageFor(a => a.Endereco)
@Html.LabelFor(a => a.Endereco)
@Html.TextBoxFor(a => a.Endereco, new { @class = "form-control", placeholder = "Ex: Avenida Paulista, 168,Bloco.A Apto.4" })
</div>
<div class="form-group">
@Html.ValidationMessageFor(a => a.Cep)
@Html.LabelFor(a => a.Cep)
@Html.TextBoxFor(a => a.Cep, new { @class = "form-control", placeholder = "Ex: 00000-000" })
</div>
<div class="form-group">
@Html.ValidationMessageFor(a => a.Cidade)
@Html.LabelFor(a => a.Cidade)
@Html.TextBoxFor(a => a.Cidade, new { @class = "form-control", placeholder = "Ex: São Paulo" })
</div>
<div class="form-group">
@Html.ValidationMessageFor(a => a.Estado)
@Html.LabelFor(a => a.Estado)
@Html.TextBoxFor(a => a.Estado, new { @class = "form-control", placeholder = "Ex: São Paulo" })
</div>
<div class="form-group">
@Html.ValidationMessageFor(a => a.Email)
@Html.LabelFor(a => a.Email)
@Html.TextBoxFor(a => a.Email, new { @class = "form-control", placeholder = "Ex:
exemplo@exemplo.com" })
</div>
<div class="form-group">
@Html.ValidationMessageFor(a => a.QuantDesejada)
@Html.LabelFor(a => a.QuantDesejada)
@Html.TextBoxFor(a => a.QuantDesejada, new { @class = "form-control", placeholder = "Ex: 10" })
</div>
<p>
<input type="submit" class="btn btn-warning btn-lg" value="Enviar" />
</p>
</div>
}