..:: MX Studio Fóruns ::..: Fomulário asp.net - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




ATENÇÃO

Para evitar posts desnecessários e que não influam para o andamento e desenvolvimento do fórum, clique aqui e leia todas as regras.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Fomulário asp.net Não funciona

#1 User is offline   Leo Master 

  • Group: Membros
  • Posts: 3
  • Joined: 02-August 10

Posted 02 August 2010 - 05:35 PM

Boa tarde Galera, tudo bem?

Sou Designer, entrei na agência a pouco tempo e aqui o programador nos deixou e junto ficou um monte de problemas, eu não saco nada de programação, por isso queria que vocês me ajudassem a resolver um.

Vamos lá:

A agência tem esse cliente http://bncinfo.tasos.uni5.net/ que na parte inferior da Home em Receba nossa Newsletter esse mini formulário não envia para o local que deveria ser enviado, e na página currículo o formulário do currículo também não está enviando, eu baixei essas duas páginas, tentei mudar o endereço de e-mail e mesmo assim não funciona, alguém poderia me ajudar a descobrir o problema? Esse currículo teria que ir para o e-mail web1@strenna.com.br. Colei o código aqui em baixo.

Página curriculos.aspx



<%@ Page Language="C#" MasterPageFile="~/internas.master" MaintainScrollPositionOnPostback="true" AutoEventWireup="true" CodeFile="curriculos.aspx.cs" Inherits="curriculos" Title="Untitled Page" %>



<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<style type="text/css">
.textoGeral
{
font-family:Calibri;
color:#102944;
}


.style5
{
width: 182px;
}
.style6
{
width: 263px;
}
.style7
{
width: 182px;
height: 22px;
}
.style8
{
width: 263px;
height: 22px;
}
.style9
{
text-align: left;
height: 91px;
}
.style11
{
width: 109px;
}
.marker, .form-required {
color: #f00;
}
* {
margin:0;
padding:0 1 0 0;
text-align: left;
}

.style12
{
width: 107px;
}
.style13
{
width: 107px;
height: 24px;
}
.style14
{
height: 24px;
}
.style15
{
width: 107px;
height: 26px;
}
.style16
{
height: 26px;
}
.style18
{
width: 524px;
}

</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="conteudo" style="color:#FFFFFF;padding:10px; font-family: Calibri; text-align: right;">
<div >
Bem vindo à BNC, preencha o formulário abaixo e faça parte do nosso banco
de talentos<br />
<br />
<asp:Panel ID="Panel1" runat="server" Width="100%" Height="100%">
<table style="width:563px; height: 216px;">
<tr>
<td class="style7">
Área de interesse:</td>
<td class="style8">
<asp:DropDownList ID="ddlArea" runat="server" Height="20px" Width="204px"
CssClass="textoGeral">
<asp:ListItem>Administração</asp:ListItem>
<asp:ListItem>Contábil</asp:ListItem>
<asp:ListItem>Fiscal</asp:ListItem>
<asp:ListItem>Trabalhista</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style5">
Nome Completo: *</td>
<td class="style6">
<asp:TextBox ID="txtNome" runat="server" Height="20px" Width="300px"
CssClass="textoGeral"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
Nome do Pai: *</td>
<td class="style6">
<asp:TextBox ID="txtPai" runat="server" Height="20px" Width="300px"
CssClass="textoGeral"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
Nome da Mãe: *</td>
<td class="style6">
<asp:TextBox ID="txtMae" runat="server" Height="20px" Width="300px"
CssClass="textoGeral"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
Data de nascimento: *</td>
<td class="style6">
<asp:TextBox ID="txtDtNas" CssClass="textoGeral" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
Sexo: *</td>
<td class="style6">
<asp:RadioButtonList ID="rdblSexo" runat="server" RepeatDirection="Horizontal">
<asp:ListItem>M</asp:ListItem>
<asp:ListItem>F</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="style5">
Estado Civil:</td>
<td class="style6">
<asp:DropDownList CssClass="textoGeral" ID="ddlEstCivil" runat="server">
<asp:ListItem>Casado</asp:ListItem>
<asp:ListItem>Solteiro</asp:ListItem>
<asp:ListItem>Divorciado</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style5">
RG: *</td>
<td class="style6">
<asp:TextBox ID="txtRg" CssClass="textoGeral" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
CPF: *</td>
<td class="style6">
<asp:TextBox ID="txtCPF" CssClass="textoGeral" runat="server" Font-Names="Calibri"
ForeColor="#102944"></asp:TextBox>
</td>
</tr>
</table>
<br />
<asp:Button ID="prox2" runat="server" CssClass="textoGeral" Text="próximo" onclick="prox2_Click"
style="text-align: left" />
<br />
</asp:Panel>


</div>
<asp:Panel ID="Panel2" runat="server" Height="350px">
<b>Contatos<br />
</b><br />
<div class="style9">
<table style="width:563px; height: 216px;">
<tr>
<td class="style11">
Endereço</td>
<td>
<asp:TextBox ID="txtEnder" CssClass="textoGeral" runat="server" Height="16px"
Width="403px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
Bairro</td>
<td>
<asp:TextBox ID="txtBairro" CssClass="textoGeral" runat="server" Width="236px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
<label for="edit-estado">
Estado: <span class="form-required" title="Este campo é obrigatório.">*</span></label></td>
<td>
<asp:TextBox ID="txtUF" CssClass="textoGeral" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
cidade</td>
<td>
<asp:TextBox ID="txtCidade" CssClass="textoGeral" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
CEP:</td>
<td>
<asp:TextBox ID="txtCEP" CssClass="textoGeral" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
Tel. Residencial</td>
<td>
<asp:TextBox ID="txtTel" CssClass="textoGeral" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
Tel. Celular</td>
<td>
<asp:TextBox ID="txtCel" CssClass="textoGeral" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
E-mail</td>
<td>
<asp:TextBox ID="txtMail" CssClass="textoGeral" runat="server" Height="20px" Width="344px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
</td>
<td>
</td>
</tr>
</table>
<asp:Button ID="voltar2" runat="server" CssClass="textoGeral" onclick="voltar2_Click" Text="voltar" />
<asp:Button ID="prox3" runat="server" CssClass="textoGeral" style="text-align: left" Text="próximo"
onclick="prox3_Click" />


<br />
</div>
<br />
<br /><br />
<br /><br />
<br />
</asp:Panel>
<asp:Panel ID="Panel3" runat="server" Height="300px">
<b>Formação<br /></b>
<div class="style9">
<table style="width:563px; height: 70px;">
<tr>
<td class="style15">
<label for="edit-escolaridade">
Escolaridade:</label></td>
<td class="style16">


<asp:DropDownList CssClass="textoGeral" ID="ddlEscola" runat="server">
<asp:ListItem>Nenhum</asp:ListItem>
<asp:ListItem>Ensino Fundamental</asp:ListItem>
<asp:ListItem>Ensino Médio</asp:ListItem>
<asp:ListItem>Ensino Técnico</asp:ListItem>
<asp:ListItem>Graduação</asp:ListItem>
<asp:ListItem>Pós-Graduação</asp:ListItem>
<asp:ListItem>MBA</asp:ListItem>
<asp:ListItem>Mestrado</asp:ListItem>
<asp:ListItem>Doutorado</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style12">
<label for="edit-escolaridade">
Curso</label></td>
<td>
<asp:TextBox ID="txtCurso" CssClass="textoGeral" runat="server" Height="20px" Width="203px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style12">
<label for="edit-escolaridade">
Instutuição</label></td>
<td>
<asp:TextBox ID="txtInstitu" CssClass="textoGeral" runat="server" Height="20px" Width="203px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style12">
</td>
<td>
</td>
</tr>
</table>
<asp:Button ID="voltar3" CssClass="textoGeral" runat="server" Text="voltar" onclick="voltar3_Click" />

<asp:Button ID="prox4" CssClass="textoGeral" runat="server"
style="text-align: right" Text="próximo" onclick="prox4_Click" />
<br />
<br /><br />
<br /><br />
<br /><br />
<br />

</div>
</asp:Panel>
<asp:Panel ID="Panel4" runat="server" Height="550px" Width="590px">
<b>Experiencia profissional:<br />
</b>
<br />
<table style="width:563px; height: 18px;">
<tr>
<td >
Empresa</td>
<td>
<asp:TextBox ID="txtEmpresa1" CssClass="textoGeral" runat="server" Height="20px" Width="203px"></asp:TextBox>
</td>
</tr>
<tr>
<td >
Função</td>
<td>
<asp:TextBox ID="txtFunc1" CssClass="textoGeral" runat="server" Height="20px" Width="203px"></asp:TextBox>
</td>
</tr>
<tr>
<td >
Inicio</td>
<td>
<asp:TextBox ID="txtIni1" CssClass="textoGeral" runat="server" Height="20px" Width="203px"></asp:TextBox>
</td>
</tr>
<tr>
<td >
Fim</td>
<td>
<asp:TextBox ID="txtFim1" CssClass="textoGeral" runat="server" Height="20px" Width="203px"></asp:TextBox>
</td>
</tr>
</table>
<br />
<hr />
<br />
<table style="width: 563px; height: 10px;">
<tr>
<td>
Empresa</td>
<td>
<asp:TextBox ID="txtEmpresa2" runat="server" CssClass="textoGeral"
Height="20px" Width="203px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Função</td>
<td>
<asp:TextBox ID="txtFunc2" runat="server" CssClass="textoGeral" Height="20px"
Width="203px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Inicio</td>
<td>
<asp:TextBox ID="txtIni2" runat="server" CssClass="textoGeral" Height="20px"
Width="203px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Fim</td>
<td>
<asp:TextBox ID="txtFim2" runat="server" CssClass="textoGeral" Height="20px"
Width="203px"></asp:TextBox>
</td>
</tr>
</table>
<br />
<asp:Button ID="voltar4" CssClass="textoGeral" runat="server" Text="voltar" onclick="voltar4_Click" />
<asp:Button ID="Enviar" runat="server" Text="enviar" onclick="Enviar_Click"
CssClass="textoGeral" />
</asp:Panel>
<asp:Panel ID="Panel5" runat="server" Height="100%">
Curriculo enviado com sucesso!<br />
<br />
<br />
<asp:Label ID="lblErro" runat="server"></asp:Label>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />

</asp:Panel>


</div>
</asp:Content>




Página curriculos.aspx.cs

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Mail;


public partial class curriculos : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Page.Title = "BNC Assessoria Contábil - Currículos";

Panel1.Visible = true;
Panel2.Visible = false;
Panel3.Visible = false;
Panel4.Visible = false;
Panel5.Visible = false;

if (!Page.IsPostBack)
{

Label lbl;
lbl = (Master.FindControl("lblHeader") as Label);
//lbl.ForeColor = System.Drawing.Color.Red;
lbl.Text = "Currículos ";
}


}


protected void SendMail(String assunto, String conteudo)
{
MailMessage mailMsg = new MailMessage();
mailMsg.From = "curriculo@bncinfo.tasos.uni5.net";
mailMsg.To = "curriculo@bncinfo.tasos.uni5.net";

mailMsg.Subject = "Curriculo 1-func";
mailMsg.Body = conteudo;


try
{
//SmtpMail.SmtpServer = "SMTP.servidor.com.br";
//SmtpMail.SmtpServer = "SMTP.bncinfo.tasos.uni5.net";
SmtpMail.SmtpServer = "smtp-web.kinghost.net";
SmtpMail.Send(mailMsg);

lblErro.Text = "Email enviado com sucesso!";
}
catch (System.Exception erro)
{
// lblErro.Text = erro.Message;
}
finally
{
mailMsg = null;
}
}



// <%@ Page Language="C#" %>
//<%@ Import Namespace="System.Web.Mail" %>
//< script runat="server">
//public void Page_Load (Object Sender, EventArgs e) {
// MailMessage mail = new MailMessage();
// mail.From = "Script de envio de emails ASP <email@dominio.com.br>"; 'Este email deve ser válido e existir como conta de email para o domínio
// mail.To = "Contato Site <email@dominio.com.br>";
// mail.Subject = "Assunto do email";
// mail.BodyFormat = MailFormat.Text;
// mail.Body = "Este é um email teste";
// SmtpMail.SmtpServer = "smtp-web.kinghost.net";
// SmtpMail.Send ( mail );
//}
//</script&gt;



protected void testMail()
{

// if request("botao") = "enviar" then
//Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
//Mailer.FromName = "Seu_Nome"
//Mailer.FromAddress= "seu_nome@seudominio.com.br"
//Mailer.RemoteHost = "smtp-web.kinghost.net"
//Mailer.AddRecipient "teste", request.form("para")
//Mailer.Subject = request.form("assunto")
//Mailer.BodyText = request.form("mensagem")

//if Mailer.SendMail then
//Response.Write "E-MAIL ENVIADO COM SUCESSO!"
//else
//Response.Write mailer.response
//end if
//response.end
//end if

}

protected void prox2_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = true;
Panel3.Visible = false;
Panel4.Visible = false;
Panel5.Visible = false;

}

protected void voltar2_Click(object sender, EventArgs e)
{
Panel1.Visible = true;
Panel2.Visible = false;
Panel3.Visible = false;
Panel4.Visible = false;
Panel5.Visible = false;
}
protected void prox3_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = false;
Panel3.Visible = true;
Panel4.Visible = false;
Panel5.Visible = false;
}
protected void voltar3_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = true;
Panel3.Visible = false;
Panel4.Visible = false;
Panel5.Visible = false;
}
protected void prox4_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = false;
Panel3.Visible = false;
Panel4.Visible = true;
Panel5.Visible = false;
}
protected void voltar4_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = false;
Panel3.Visible = true;
Panel4.Visible = false;
Panel5.Visible = false;
}
protected void Enviar_Click(object sender, EventArgs e)
{
// Response.Write("<script language='javascript'> alert('Curriculo enviado com sucesso!');</script>");
String assunto = "Curriculo - " + txtNome.Text;

//// SendMail(assunto, setConteudo());
////limpaCampos();

Panel1.Visible = false;
Panel2.Visible = false;
Panel3.Visible = false;
Panel4.Visible = false;
Panel5.Visible = true;


EnviaCurriculo();

}


protected void EnviaCurriculo()
{
String auxCurriculo = "";


auxCurriculo = "<style type='text/css'> " +
" .p2 {color: #000099;background-color: #FFFFFF;} " +
" .p{color: #3333FF;} " +
" </style> " +
" <p><span class='p2'>Curriculo</span></p>" +
" <p>Área de Interesse: " + ddlArea.SelectedItem.Text + " </p> " +
" <p> Nome: " + txtNome.Text + "</p>" +
" <p> Nome do Pai: " + txtPai.Text + "</p>" +
" <p> Nome da Mãe: " + txtMae.Text + "</p>" +
" <p> Data de nascimento: " + txtDtNas.Text + "</p>" +
" <p> Sexo: " + rdblSexo.SelectedItem.Value + "</p>" +
" <p> Estado Civil: " + ddlEstCivil.SelectedItem.Value + "</p>" +
" <p> RG: " + txtRg.Text + "</p>" +
" <p> CPF: " + txtCEP.Text + "</p>" +
" <hr/> " +
" <p> CONTATOS </p><br />" +
" <p> Endereço: " + txtEnder.Text + "</p>" +
" <p> Bairro: " + txtBairro.Text + "</p>" +
" <p> Estado: " + txtUF.Text + "</p>" +
" <p> Cidade: " + txtCidade.Text + "</p>" +
" <p> CEP: " + txtCEP.Text + "</p>" +
" <p> Tel. Residencial: " + txtTel.Text + "</p>" +
" <p> Tel. Celular:" + txtCel.Text + "</p>" +
" <p> E-mail: " + txtMail.Text + "</p>" +
" <hr/> " +
" <p> FORMAÇÃO </p><br />" +
" <p> Escolaridade: " + ddlEscola.SelectedItem.Text + "</p> " +
" <p> Curso: " + txtCurso.Text + "</p>" +
" <p> Instutuição: " + txtInstitu.Text + "</p>" +
" <hr /> " +
" <p>EXPERIÊNCIA PROFISSIONAL:</p><br /> " +
" <p> Empresa: " + txtEmpresa1.Text + "</p>" +
" <p> Função: " + txtFunc1.Text + "</p>" +
" <p> Inicio: " + txtIni1.Text + "</p>" +
" <p> Fim: " + txtFim1.Text + "</p>" +
" <hr/> " +
" <p> Empresa: " + txtEmpresa2.Text + "</p>" +
" <p> Função: " + txtFunc2.Text + "</p>" +
" <p> Inicio: " + txtIni2.Text + "</p>" +
" <p> Fim: " + txtFim2.Text + "</p>" +
" <hr/> " ;




String _auxSubj = "teste do envio de curriculo: " + txtNome.Text;

enviaEmail(auxCurriculo,_auxSubj);

}

protected void enviaEmail(String auxBody, String auxSubj)
{
try
{
MailMessage mail = new MailMessage();
mail.From = "web1@strenna.com.br"; //Este email deve ser válido e existir como conta de email para o domínio
mail.To = "web1@strenna.com.br";
mail.Subject = auxSubj;
mail.BodyFormat = MailFormat.Html;
mail.Body = auxBody;
//SmtpMail.SmtpServer = "smtp-web.kinghost.net";
SmtpMail.SmtpServer = "smtp-web.uni5.net";

SmtpMail.Send ( mail );
Response.Write("email enviado com sucesso");

//Response.Redirect("index.html");

}

catch (Exception erro)
{
Response.Write(erro.Message);
}

}





protected String setConteudo()
{

String auxConteudo = "";

auxConteudo += "Area= " + ddlArea.SelectedItem.Text + "<br />";
auxConteudo += "Nome= " + txtNome.Text + "<br />";
auxConteudo += "Pai= " + txtPai.Text + "<br />";
auxConteudo += "Mae= " + txtMae.Text + "<br />";
auxConteudo += "data de nascimento= " + txtDtNas.Text + "<br />";


return auxConteudo;

}

protected void limpaCampos()
{

txtNome.Text ="";
txtPai.Text ="";
txtMae.Text = "";
txtDtNas.Text = "";

txtRg.Text = "";
txtCPF.Text = "";

txtEnder.Text ="";
txtBairro.Text ="";
txtUF.Text ="";
txtCidade.Text ="";
txtCEP.Text ="";
txtTel.Text ="";
txtCel.Text ="";
txtMail.Text ="";

txtCurso.Text ="";
txtInstitu.Text ="";

txtEmpresa1.Text ="";
txtFunc1.Text ="";
txtIni1.Text ="";
txtFim1.Text ="";
txtEmpresa2.Text ="";
txtFunc2.Text ="";
txtIni2.Text ="";
txtFim2.Text = "";
}


}
0

#2 User is offline   xanburzum 

  • Group: Administrador
  • Posts: 2077
  • Joined: 04-November 08

Posted 03 August 2010 - 02:37 PM

verifique se o email e SMTP estão configurados corretamente...
ela gera algum número de erro ???
0

#3 User is offline   Leo Master 

  • Group: Membros
  • Posts: 3
  • Joined: 02-August 10

Posted 10 August 2010 - 05:24 PM

Falae xanburzum, vou dar uma olhada nesse SMTP, ele não gera nenhum erro.

View Postxanburzum, on 03 August 2010 - 02:37 PM, said:

verifique se o email e SMTP estão configurados corretamente...
ela gera algum número de erro ???

0

#4 User is offline   xanburzum 

  • Group: Administrador
  • Posts: 2077
  • Joined: 04-November 08

Posted 11 August 2010 - 03:46 PM

veja como esta a configuração, se a porta esta liberada...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


Similar Topics Collapse


Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)