I have a contact from which is working fine but when I receive an email from it, it displays from support@ukhosting.net (which is my hosting company). How can I get it so that it displays from the email address which is entered on the contact form.
My code is
- Code: Select all
<?php
/*** ---------- CHANGE THIS TO YOUR EMAIL ADDRESS ------------- ***/
$MAIL_TO = myemail@mydomain.co.uk';
/*** ---------------------------------------------------------- ***/
$subject = "Web Site Contact Us :: GG";
$time = date('d-m-Y H:i');
$fname = $_POST['fname-field'];
$lname = $_POST['lname-field'];
$mail = $_POST['mail-field'];
$telephone = $_POST['telephone-field'];
$telephone2 = $_POST['telephone2-field'];
$company = $_POST['company-field'];
$message = $_POST['message-field'];
$name = $fname . ' ' . $lname;
$body = "Website Enquiry Sent: $time\n\n";
$body .= "Name: $name\nEmail: $mail\nTelephone: $telephone\nAlt Telephone: $telephone2\nCompany: $company\n";
$body .= "Message: $message\n";
@mail($MAIL_TO, $subject, $body);
echo 'sent!';
?>

