PHP Mail Form Problems
Posted: Tue Dec 02, 2008 1:32 pm
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@p3nlh023.shr.prod.phx3.secureserver.net
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 = 'myemail@mydomainname.com';
$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: myalternateemail@whatever.com' . "\r\n";
$headers .= 'Bcc: myalternateemail@whatever.com' . "\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!
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 = 'myemail@mydomainname.com';
$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: myalternateemail@whatever.com' . "\r\n";
$headers .= 'Bcc: myalternateemail@whatever.com' . "\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!