News:

Click here for Toll-Free Service for your business starting at $2.00 per month

Main Menu

Do you find error?

Started by computerman, November 15, 2005, 09:28:10 AM

Previous topic - Next topic

computerman

Hi...
I have this script for send email, from my site...but when i send email, the email os from "computerman@freepgs.com" and not "Computerman Site". Look this code...please!

if(ereg("^(.+)@(.+)\\.(.+)$",$to))
{
}else{
echo("You must supply a valid (TO) address<br>");
echo("<script>alert(\"Error:Click Here To Go Back\");history.go(-1)</script>");
exit;
}

// Removes html tags and whitespace from input data
$to =strip_tags(trim($to));
$subject =strip_tags(trim($subject));
$body =strip_tags(trim($body));
$from ="Computerman Site" ;

// formats the headers section DO NOT ALTER OR MAKE ANY CHANGES

$headers  ="Mime-Version: 1.0\r\nContent-Type:text/plain charset=\"ISO-8859-1\"\r\n";
$headers .="Content-Transfer-Encoding: 7bit\r\n";
$headers .="X-Priority: 3\r\n";
$headers .="X-PHP-Mail-Priority: Normal\r\n";
$headers .="X-Mime-OLE: Produced by MS MimeOLE v5.00.3000.100\r\n";
$headers .="X-Mailer: PHP Mail generated by:PHPMailer v1.0\r\n";
$headers .= "Computerman Site";


// formats the input and sends the email
$send=mail($to,$subject,$message);

// prints success or failure to the user
if($send==1){
    echo("<html><head><title>SUCCESS...Email Spedita</title></head><body>");
echo("<center><h2>Success....</h2><br><p>La tua email è stata spedita!<br>");
echo("<a href=\"form.php\">Clicca qui per spedire un'altra email</a></p></center>");
echo("</body></html>");
}else{
echo("<html><head><title>FAILURE...L'email non è stata spedita</title></head><body>");
echo("<center><h2>Sorry....</h2><br><p>There appears to have been a problem<br>");
echo("in processing your email<br>Please try again later...<br>");
echo("<a href=\"form.php\">PHPMAILER</a><br>");
echo("Thank You for using PHP Mailer v1.0</p></center>");
echo("</body></html>");
}
// finally everything OK, exit the script
exit();


where is the error?
thx

webzone (archived)

First of all, you are not reusing your variable $from anywhere in your code. This isn't the cause of the error, but just setting a variable and then forgetting it wastes memory.

The error may come from this line of your code
$headers .= "Computerman Site";

"Computerman Site" is NOT a valid message header. It should look like "From: email@ddress.example.com" or "From: Someone's website <someone@example.net>". You must provide an e-mail address if you add the From field.

computerman

thx...but in old version of host this script running ok!
In any case...i try ;)