Neste código será apresentado uma função bem simples para o envio de e-mails utilizando PHP.
página: index.phppágina: contato_envia.php "; echo "window.open('contato.php?erro=" . $erro . "','_self')"; echo ""; } if (!empty($_POST['frm_nome'])) { $nome = $_POST['frm_nome']; } else { retorna(nome); exit; } if (!empty($_POST['frm_email'])) { $email = $_POST['frm_email']; } else { retorna(email); exit; } if (!empty($_POST['frm_telefone'])) { $telefone = $_POST['frm_telefone']; } else { $telefone = ""; } if (!empty($_POST['frm_telefone2'])) { $telefone_pre = $_POST['frm_telefone2']; $telefone_pre = "(" . $telefone_pre . ")"; } else { $telefone_pre = ""; } if (!empty($_POST['frm_assunto'])) { $assunto = $_POST['frm_assunto']; } else { retorna(assunto); exit; } if (!empty($_POST['frm_texto'])) { $texto = $_POST['frm_texto']; } else { retorna(texto); exit; } ?> " . $telefone_pre . " " . $telefone ."
" . $texto; $headers .= " $email <$email>rn"; $headers .= "MIME-Version: 1.0rn"; $headers .= "Content-type: text/html; charset=iso-8859-1rn"; mail("email_que_recebe",$assunto,$mensagem,"From: ".$headers) or die ("
Erro ao enviar o email
clique aqui para voltar
Seu pedido foi enviado com sucesso!
clique aqui para voltar