306 TD Slut
hi, i have this code for a form on my website. i dont know anything about php, but am told this is basic lol. just gets form info from the form and sends it to my yahoo address.
i got it working and now receive info, BUT.
when i recieve the email in my yahoo inbox no matter what the user types in the address and name field, it doesnt give it to me.
if someone filled in the fields like this:
name: mark
address: mark_r52002@hotmail.com
subject: testy
message: blah blah
i would recieve it and it would say:
from: mark@yahoo.com,
subject:testy
message: blah blah
how is it getting the name and using it in the from email field, and more to the point.. where the hell is it getting the @yahoo.com bit as it was not entered into any of the box's.
thanky
Code:
//Configuration
$email_address = "[EMAIL="mark.simons@yahoo.co.uk"]mark.simons@yahoo.co.uk[/EMAIL]"; //This should be changed to your email address.
$subject_prefix = "From marksimons.co.uk "; //This will be the subject prefix of all emails. default "Website Contact - User Subject
// --- Do not modify below ---
//Collects varibles from previous page.
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $subject_prefix . $_POST['subject'];
$message = $_POST['message'];
//This part should prevent malicous doings.
//Most servers are setup in such a way that this section is not needed but its a good security precaution to have.
$from = urldecode($email);
if (eregi("\r",$from) || eregi("\n",$from)){
print "Malformed Headers were detected.";
exit;
}
//This part sends the email to you.
mail($email_address, $subject, $message, "From: $name <$email>\nX-Mailer: Simple PHP Contact Form 1.0 ([URL="http://www.korske.com"]www.korske.com[/URL])");
//Redirects to sent.html
header("Location: sent.html")
?>
i got it working and now receive info, BUT.
when i recieve the email in my yahoo inbox no matter what the user types in the address and name field, it doesnt give it to me.
if someone filled in the fields like this:
name: mark
address: mark_r52002@hotmail.com
subject: testy
message: blah blah
i would recieve it and it would say:
from: mark@yahoo.com,
subject:testy
message: blah blah
how is it getting the name and using it in the from email field, and more to the point.. where the hell is it getting the @yahoo.com bit as it was not entered into any of the box's.
thanky