Skip to content

Instantly share code, notes, and snippets.

@thulioph
Created June 18, 2014 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thulioph/e410c07bc0a93d6986d7 to your computer and use it in GitHub Desktop.
Save thulioph/e410c07bc0a93d6986d7 to your computer and use it in GitHub Desktop.
envio de formulario via php
<?php
extract($_POST);
$mens = "
<b>Nome:</b> ".$nome."<br /><br />
<b>Banco:</b> ".$banco."<br /><br />
<b>Assunto:</b> ".$assunto."<br /><br />
<b>CPF ou Contrato:</b> ".$cpf."<br /><br />
<b>Telefone:</b> ".$telefone."<br /><br />
<b>Email:</b> ".$email."<br /><br />
<b>Mensagem:</b> ".$mensagem."<br /><br />
";
if (eregi('tempsite.ws$|locaweb.com.br$|hospedagemdesites.ws$|websiteseguro.com$', $_SERVER[HTTP_HOST])) {
$emailsender="email@dominio.com.br"; // Substitua essa linha pelo seu e-mail@seudominio
} else {
$emailsender = "email@dominio.com.br";
}
if(PATH_SEPARATOR == ";") $quebra_linha = "\r\n"; //Se for Windows
else $quebra_linha = "\n"; //Se "não for Windows"
$cabecalho = "From: $nome <$emailsender> $quebra_linha";
$cabecalho .= "Reply-To: $nome <$email> $quebra_linha";
$cabecalho .= "MIME-Version: 1.0$quebra_linha";
$cabecalho .= "Content-type: text/html; charset=iso-8859-1$quebra_linha";
$envia = mail("email1@meudominio.com.br","Contato site",utf8_decode($mens),$cabecalho,"-r".$emailsender);
$envia .= mail("email2@meudominio.com.br","Contato site",utf8_decode($mens),$cabecalho,"-r".$emailsender);
if($envia){
echo "Email enviado com sucesso!";
}else{
echo "Erro ao enviar email!";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment