Trying to add CC and BCC to form


#1

Hello,

I need help with the following script (generated at http://www.thesitewizard.com) I customized it just a tad (adding a few fields). My issue is that I would like to CC: the person who fills out the form (so they get a copy in their own e-mail…so I want to use the $email variable) and also a BCC: to an internal member of another affiliate. Here’s the script:

[php]
$mailto = missniceness79@yahoo.com" . $headersep . “BCC: <$email>” . $headersep . “X-Mailer: chfeedback.php 2.07” );
header( “Location: $thankyouurl” );
exit ;

?>[/php]

The message prints the CC:, but it does not actually come through. I tried to define the e-mails with the $headersep variable, but kept getting parsing errors; even after defining $headersep after $email. I have an old book on PHP which does not address CC and BCC at all. Online, I can’t find any example where a variable is used for the e-mail recipient. Any ideas?

Oh, and if you want to see the form, it is: http://www.shonasporch.com/CLE/Riemerpopup.html

Admin Edit: Changed QUOTE tags to PHP tags for readability


#2

Look into the following code and see if you can’t get something working with it.

[php]
// To send HTML mail, the Content-type header must be set
$headers = ‘MIME-Version: 1.0’ . “rn”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “rn”;

// Additional headers
$headers .= ‘To: Mary mary@example.com, Kelly kelly@example.com’ . “rn”;
$headers .= ‘From: Birthday Reminder birthday@example.com’ . “rn”;
$headers .= ‘Cc: birthdaycheck@example.com’ . “rn”;

// Mail it
mail($to, $subject, $message, $headers);
[/php]

I found the example at http://www.php.net/manual/en/function.mail.php

This is best place to look for referance to any php functions.