Created
December 13, 2013 17:31
-
-
Save kikobr/7947960 to your computer and use it in GitHub Desktop.
Envio de email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$nome = $_POST['nome']; | |
$email = $_POST['email']; | |
$telefone = $_POST['telefone']; | |
$mensagem = $_POST['mensagem']; | |
$to = "[email protected]"; | |
$subject = "Assunto do E-mail"; | |
$message = "Nome: ".$nome."<br/>"; | |
$message .= "Email: ".$email."<br/>"; | |
$message .= "Telefone: ".$telefone."<br/>"; | |
$message .= "Mensagem: ".$mensagem."<br/>"; | |
$header = "From:".$email." \r\n"; | |
$header .= "MIME-Version: 1.0\r\n"; | |
$header .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; | |
// -- Envia o e-mail | |
$retval = mail($to,$subject,$message,$header); | |
$retval2 = mail($to2,$subject,$message,$header); | |
if( $retval == true ) { | |
echo "<script type='text/javascript'> | |
alert('E-mail enviado com sucesso!') | |
window.location.href='contato.php'; | |
</script>"; | |
} | |
else { | |
echo "<script type='text/javascript'> | |
alert('Falha no envio do e-mail! Por favor, contate-nos pelo e-mail ao lado.') | |
window.location.href='contato.php'; | |
</script> | |
"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment