PDA

View Full Version : Problem with Form Code...


EscortCossie
01-18-2004, 11:08 AM
Hi, I wonder if any1 could take a look at my code and tell me whats wrong? The script works ok, but when I receive the e-mail it sends it appear like not anyone has sendt it.. Why is anonymus@myhost.com the address that sent the e-mail? I would like to change this to info@escortpower.net or something.

Here is what the e-mails look like:
From: anonymous@myhost.com
To: webmaster@escortpower.net
Subject: Order

...NAME... has used the order form.

Name: .....
Address: .....
City: .....
Post Code: .....
Country: .....
E-Mail: .....
Phone: .....
Phone: .....
Quantity: .....

Other than this the script works great! Anyway, here is the code: (I apologize if it is a little messy, but it is my first PHP code..):)
<?

PRINT "<center><FONT SIZE=-1 face=tahoma>"; PRINT "<br><br><br><br>Thank you <b>$name</b>, for your order!<p>";
PRINT "We will send an invoice to <b>$email</b> within 3 working days.<p>";
PRINT "If you have any questions, feel free to reply to the email sent to you.<br><br><br><br><br><br>";
PRINT "<b>You can now close this window</b>";

mail("$email", "EscortPower.net Sticker", "Hi $name,\nWe thank you again for your order.
\n\nYour order has been sent to EscortPower.net and
we will send you an invoice within 3 working days.\n\nEscortPower.net");

mail("webmaster@escortpower.net", "Order", "$name used the order form.
\n\n\n\n\n Name: $name \n Address: $address \n City: $city \n Post Code: $postcode \n Country: $country \n E-Mail: $email \n Phone: $phone1 \n Phone: $phone2 \n Quantity: $quantity");

?>

Hope someone can help me out with this. Thanx in advance,

- EscortCossie

Viper007Bond
01-18-2004, 11:49 AM
From http://www.php.net/manual/en/function.mail.php:

<?php
mail("nobody@example.com", "the subject", $message,
"From: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
"Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
"X-Mailer: PHP/" . phpversion());
?>i.e. you need to set the extra headers.

More information about all that stuff is mentioned at the above link. :)

EscortCossie
01-18-2004, 01:29 PM
Thanx a lot! :)

Viper007Bond
01-18-2004, 04:18 PM
Yep. :)