function Enviar_email($assunto, $email_enviado, $erro, $post) { $destino = "myemail@somedomain.com"; $email = htmlentities(addslashes($post["email"])); $nome = htmlentities(addslashes($post["nome"])); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; if($email) { $headers .= "From: $nome <$email>\r\n"; } else { $headers .= "From: Formulário de Contato\r\n"; } $mensagem = ""; foreach($post as $key => $value) { $mensagem .= $key . ": " . $value . "
"; } $mensagem .= ""; if (mail($destino,$assunto,$mensagem,$headers)) { echo $email_enviado; }else{ echo $erro; } }