mail function help


#1

hi
everything seems to be working with this form except in the email sent to me the $email from the form is not there ?
the subject,message and name are there but no email address from the form ???
any help !!!
thanks

<?php $email = $HTTP_POST_VARS['email']; $subject = $HTTP_POST_VARS['subject']; $message = $HTTP_POST_VARS['message']; $name = $HTTP_POST_VARS['name']; if (!preg_match("/w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*/", $email)) { echo "Please enter a valid email address"; echo "Back"; } elseif ($subject == "") { echo "Please enter a subject"; echo "Back"; } elseif (mail("email@email.com",$subject,$message,$name,$email)) { echo "Thank you for your enquiry.
A representative will get back to you shortly.

"; } else { echo "Cant send email to $email"; echo "Back"; } ?>

#2

Change:

elseif (mail("email@email.com",$subject,$message,$name,$email))

to this:

else if mail("email@email.com",$subject,$message,"From:$name<$email>")

#3

thanks carella !
that didnt exactly work ,but this did - happy happy joy joy

elseif (mail("email@email.com",$subject,$message,"From:$name<$email>"))
:D

#4

Sorry I missed the brackets, that was accidental.

Glad its now working ok. :)