PDA

View Full Version : another php form problem...



alapimba
December 13th, 2007, 11:25 AM
Hello
I'm doing a form in flash and send it with php, it works and send the form but the e-mail from the sender is not dispalyed correcly...

here is my php code:


<?php
$sendTo = "mymail@mycompany.com";
$subject = "Frase de Natal";
$nome = $_POST['nome'];
$email = $_POST['email'];
$cargo = $_POST['cargo'];
$empresa = $_POST['empresa'];
$frase = $_POST['frase'];
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: " . $_POST["nome"]"\r\n";
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];

$message = "Frase Postal de Natal \r\n";
$message.= "
<html>
<head>
<title>Untitled Document</title>
<style type=\"text/css\">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
-->
</style>
</head>
<body bgcolor=\"ffffff\">
<p><strong>Nome:</strong> $nome <strong><br/>
Email:</strong> $email<strong><br />
Cargo:</strong> $cargo<strong><br />
Empresa:</strong> $empresa<strong><br />
Frase:</strong> $frase<strong><br />
</strong></p>
</body>
</html>
";
mail($sendTo, $subject, $message, $headers);
?>

the email sent has this on the headers:

To: mymail@mycompany.com Subject: Frase de Natal
From: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#EB211F\" LETTERSPACING=\"0\" KERNING=\"0\">rogério12345678</FONT></P></TEXTFORMAT><<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#EB211F\" LETTERSPACING=\"0\" KERNING=\"0\">alapimba@hotmail.com</FONT></P></TEXTFORMAT>>
Reply-To: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#EB211F\" LETTERSPACING=\"0\" KERNING=\"0\">alapimba@hotmail.com</FONT></P></TEXTFORMAT>

simplistik
December 13th, 2007, 12:07 PM
http://www.kirupa.com/forum/showthread.php?t=282886

alapimba
December 13th, 2007, 12:23 PM
i have read that thread before and didn't realize what i was doing wrong... :(

simplistik
December 13th, 2007, 02:20 PM
$headers .= "From: " . strip_tags($_POST["nome"])."\r\n";
$headers .= "<" . strip_tags($_POST["email"]) . ">\r\n";
$headers .= "Reply-To: " . strip_tags($_POST["email"]) . "\r\n";
$headers .= "Return-Path: " . strip_tags($_POST["email"]);

alapimba
December 14th, 2007, 06:10 AM
didnt solved the problem...
now i receive the mail with the headers:

Subject: Frase de Natal
From: rogerio@minho102.servidorpt.com

minho102.servidorpt.com it's the name of the server... i don't understand where the script got this info..

simplistik
December 14th, 2007, 09:26 AM
Well... in your code your headers are formatted incorrectly


$headers .= "From: " . $_POST["nome"]"\r\n";
$headers .= "<" . $_POST["email"] . ">\r\n";

you need to add a . after $_POST["nome"]