Friday, July 16, 2010

Php email help?

ok i added another text field to the html page and made name = Email


n made this $Email = Trim(stripslashes($_POST['Email']));





but not sure how to add the $Email to body?thats my Q





%26lt;?php


// get posted data into local variables


$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));


$EmailTo = "babemagnet_bbmgnt@yahoo.com";


$Subject = Trim(stripslashes($_POST['Subject']));


$Body = Trim(stripslashes($_POST['Body']));


$Email = Trim(stripslashes($_POST['Email']));


// validatio


$validationOK=true;


if (Trim($EmailFrom)=="") $validationOK=false;


if (!$validationOK) {


print "%26lt;meta http-equiv=\"refresh\" content=\"0;URL=error.html\"%26gt;";


exit;


}


// body text


$Body = "";


$Body .= $Body;


$Body .= "\n";





// send mail


$success = mail($EmailTo, $Subject, $Body, "From: %26lt;$EmailFrom%26gt;");





// redirect tosuccess


if ($success){


print "%26lt;meta http-equiv=\"refresh\" content=\"0;URL=ok.html\"%26gt;";


}


else{


print "%26lt;meta http-equiv=\"refresh\" content=\"0;URL=error.html

Php email help?
You are well on your way to creating a spammers delight.


It's nearly ready.





You need to google on


header injection email scripts





You need to check for newlines. and various headers signatures or within weeks you will be hit hard by a spam botnet.


You will get your domain blacklisted and your hosting company will take your script down.





I guarantee it.





Then when that's sorted, you need to check and limit the number of characters sent to your script. Or some bright spark will send you a million zero's or something.
Reply:Change this line:





$success = mail($EmailTo, $Subject, $Body, "From: %26lt;$EmailFrom%26gt;");





to this:





$success = mail($EmailTo, $Subject, $Body, "From: $EmailFrom %26lt;$Email%26gt;");





It will make the From header look like this:





From: Joe Black %26lt;jblack@yahoo.com%26gt;





which is the correct syntax to include the name of the sender with his email address.
Reply:What are the different fields EmailTo, EmailFrom, Email and Body?





Explain your code and you'll get some help. I think you have one field too many. What is this Email field/variable for?

dental hygiene

No comments:

Post a Comment