From and BCC issues

Hi gang — I’m a novice who’s figuring out php with this project. The php code below is for a live site recently acquired.

This is the intended purpose of the php:
An RFQ info is compiled via html and Flash, then sent to this sendmail code which assembles the RFQ, which routes it to several recipients. (I have not included the actual email addresses for their confidentiality.)

By the way this all works except for the issues listed below.

Here are my two known issues:
The “From” field currently shows where the email address where the Flash/email is assembled. I would like the from field to show the real senders name — not where the flash/email was assembled.

“BCC” does not go to the three recipients email.

Your knowledge and expertise will be greatly appreciated.

[php]

<?php $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; if(empty($_POST['mail_reply_to'])){ echo"no email address found"; exit; } $fName = $_POST['fname']; $lName = $senderName.$_POST['lname']; $senderCustomerRef = $_POST['customer']; $senderTel = $_POST['tel']; $senderEmail = $_POST['mail_reply_to']; $senderOrg = $_POST['org']; $senderOrgStreet = $_POST['street']; $senderOrgCity = $_POST['city']; $senderOrgState = $_POST['states']; $senderOrgZip = $_POST['zipcode']; $senderOrgCountry = $_POST['country']; $senderComments = $_POST['comments']; $senderShipAddress = $_POST['ship1']; $senderShipCity = $_POST['ship2']; $senderShipCountry = $_POST['ship3']; $senderShipState = $_POST['ship4']; $senderShipZip = $_POST['ship5']; $newLetter = nl2br($_POST['newsletterSubscribe']); $Order = nl2br($_POST['productOrder']); if($newLetter == "Yes"){ $newsLetter = "Yes, I want regular updates"; } if($newLetter == "No"){ $newsLetter = "No, I don't want regular updates"; } //$to = "@.com"; $to = "@.com,@.com"; //$cc = ""; $bcc = "@.com,@.com,@.com"; //$headers .= "CC: <".$cc."> \r\n"; $headers .= "Bcc:".$bcc.",\r\n"; $ToName = ""; $date = date("m/d/Y H:i:s"); $ToSubject = "Isoflex Request For Quote"; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody.""; $EmailBody = $EmailBody."
$fName $lName
$senderEmail
$senderTel

Mailing Address:
$senderOrg
$senderCustomerRef
$senderOrgStreet
$senderOrgCity, $senderOrgState $senderOrgZip
$senderOrgCountry

Shipping Address:
$senderOrg
$senderShipAddress
$senderShipCity, $senderShipState $senderShipZip
$senderShipCountry

Quote Request:
$Order

Comments:
$senderComments

Send information:
$newsLetter
"; // write fwrite($fh, $EmailBody); $EmailFooter = "

Sent: $date

"; $Message = $EmailBody.$EmailFooter; // write fwrite($fh, $to); fwrite($fh, $ToSubject); fwrite($fh, $Message); fwrite($fh, $headers); fwrite($fh, $fName); fwrite($fh, $lName); $ok = mail($to, $ToSubject, $Message, $headers . "From:$fName $lName <".$to.">"); if($ok){ echo "retval=1"; echo $EmailBody; }else{ echo "retval=0"; } fclose($fh); ?>

:’([/php]

Hey,
I’m not an expert but this is not how I would do it, but I will do my best to help you.

[php]
// write
fwrite($fh, $to);
fwrite($fh, $ToSubject);
fwrite($fh, $Message);
fwrite($fh, $headers);
fwrite($fh, $fName);
fwrite($fh, $lName);
[/php]

I don’t really understand this but okay?

[php]
$ok = mail($to, $ToSubject, $Message, $headers . “From:$fName $lName <”.$to.">");
if($ok){
echo “retval=1”;
echo $EmailBody;
}else{
echo “retval=0”;
}
fclose($fh);
[/php]
The $headers is very unusual. “I” would do it like this…

[php]
$ok = mail($to, $ToSubject, $Message, "From: " . $fName . $lName . “<” . $to . “>”);
[/php]
That might be a error. I did not test this, but from my knowledge this looks correct.
Please reply if it does not work.

Sponsor our Newsletter | Privacy Policy | Terms of Service