TheSaint97 Posted December 2, 2008 Share Posted December 2, 2008 Ok for the most part this script gets the job done. However, for some strange reason when I receive the email from them, instead of having their email address in the "From:" it has some weird address like: [email protected] Now in the body of the email it will list their correct address. Here is part of the script I'm using... <?php /* Subject and Email Variables */ $to = '[email protected]'; $subject = 'Form Submission'; /* Data Variables */ $name = $_POST['name']; $phone = $_POST['phone']; $address = $_POST['address']; $name = $_POST['name']; $phone = $_POST['phone']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $email = $_POST['email']; $type = $_POST['type']; $reason = $_POST['reason']; $value = $_POST['value']; $owed = $_POST['owed']; $repairs = $_POST['repairs']; $agent = $_POST['agent']; $offer = $_POST['offer']; /* What Will Appear in Body of Email */ $body = <<<EOD <br><hr><br> Name = $name <br> Phone = $phone <br> Address = $address <br> City = $city <br> State = $state <br> Email = $email <br> Type = $type <br> Reason = $reason <br> Value = $value <br> Owed = $owed <br> Repairs = $repairs <br> Agent = $agent <br> Offer = $offer <br> EOD; /* To send HTML mail, the Content-type header must be set */ $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; /* Additional headers */ $headers .= 'From: $email' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; /* Mail it */ mail($to, $subject, $body, $headers); Also, once in awhile I will get an email where the body is completely empty. It will still list Name = Phone = Address = City = State = Email = Type = Reason = Value = Owed = Repairs = Agent = Offer = It just doesn't show the answer they gave. I'm a beginner so any help would be greatly appreciated. Thanks! Link to comment https://forums.phpfreaks.com/topic/135216-php-mail-form-help/ Share on other sites More sharing options...
DeanWhitehouse Posted December 2, 2008 Share Posted December 2, 2008 You aren't checking if the form has even been posted or running any form validation, also your host might not allow you to send from emails that aren't registered with them. Please use code tags Link to comment https://forums.phpfreaks.com/topic/135216-php-mail-form-help/#findComment-704251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.