So here is my latest question team...

The project I am working now the I needs to be modified..

Its a form with checkboxes on who you would like to send this message to... at first I thought it was fine just sending out with everyone on the "to:" list of recipients but now maybe I want to have it send out each email as a separate email...

Here is my script...

// Connect to server and select database. 
mysql_connect("$hostname", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB"); 

// Get values from form 

// Insert data into mysql 
$sql="INSERT INTO $tbl_name(firstprospect, lastprospect, addressprospect, cityprospect, stateprospect, azipprospect, prefixprospect, email0, fmail1, fmail2, fmail3, fmail4, prospectmessage)
VALUES('$firstprospect', '$lastprospect', '$addressprospect', '$cityprospect', '$stateprospect', '$azipprospect', '$prefixprospect', '$email0', '$fmail1', '$fmail2', '$fmail3', '$fmail4', '$prospectmessage')"; 

if(count($_POST)) {
foreach(array('fmail1','fmail2','fmail4','fmail3','email0','firstprospect','lastprospect','addressprospect','cityprospect','stateprospect','azipprospect','prefixprospect') as $key) $_POST[$key] = strip_tags($_POST[$key]);
if(!is_secure($_POST)) { die("thank you no thanks");}

# submits a notification to you when 
# the form is submitted

// Email address for copies to be sent to - sean@surfgraphics
$emailto = ""; 
// Notification email subject text for copies
$esubject = "<<<BNE TAKE ACTION test SUBMISSION>>>"; 

// Email body text for notifications
$emailtext = "
$_POST[prefixprospect] $_POST[firstprospect] $_POST[lastprospect]
$_POST[cityprospect],$_POST[stateprospect] $_POST[azipprospect] 


Has sent a Take Action email to following recipients:



# This function sends the email to you

@mail("$emailto", $esubject, $emailtext, "From: $_POST[email0]");

# This part is the function for sending to recipients

// Page to display after successful submission
// Change the thankyou.htm to suit

$thankyoupage = "index.html"; 

// Subject line for the recommendation - change to suit

$tsubject = "My support of Wind Prospect ";

// Change the text below for the email 
// Be careful not to change anyt "$_POST[value]" bits

$ttext = "

To: Our Local Prospect Official,
Subject: My support of Wind Prospect 


Thank you...
$_POST[prefixprospect] $_POST[firstprospect] $_POST[lastprospect]
$_POST[cityprospect],$_POST[stateprospect] $_POST[azipprospect]

# This sends the note to the addresses submitted
@mail("$_POST[fmail1],$_POST[fmail2],$_POST[fmail3],$_POST[fmail4]", $tsubject, $ttext, "FROM: $_POST[email0]");

# After submission, the thank you page
header("Location: $thankyoupage");

# Nothing further can be changed. Leave the below as is

function is_secure($ar) {
$reg = "/(Content-Type|Bcc|MIME-Version|Content-Transfer-Encoding)/i";
if(!is_array($ar)) { return preg_match($reg,$ar);}
$incoming = array_values_recursive($ar);
foreach($incoming as $k=>$v) if(preg_match($reg,$v)) return false;
return true;

function array_values_recursive($array) {
$arrayValues = array();
foreach ($array as $key=>$value) {
if (is_scalar($value) || is_resource($value)) {
$arrayValues[] = $value;
$arrayValues[] = $key;
elseif (is_array($value)) {
$arrayValues[] = $key;
$arrayValues = array_merge($arrayValues, array_values_recursive($value));
return $arrayValues;

SO I need to modify line 91 so it sends it as individual emails instead of multiple names on to list..

Thanks as always....

If you are doing this for privacy reasons, you could also make all of the addressees BBC's and use yourself as the To.

no just so they think they are the only one getting this.. so I would want each person to be in the to: line by themselves..

You need a loop around the mail statement or if it is always limited to 4 addresses you could just repeat the mail statement 4 times with one addressee in each one.

that worked... But I'm getting internal server error now... Not sure if its a coincidence or not...