All pastes #264482 Raw Edit

sapo

public php v1 · immutable
·published 2006-12-02 13:40 UTC
rendered paste body
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 = "<html><head></head><body>";	foreach($post as $key => $value) {		$mensagem .= $key . ": " . $value . "<br />";	}	$mensagem .= "</body></html>";	if (mail($destino,$assunto,$mensagem,$headers)) {		echo $email_enviado;	}else{		echo $erro;	}}