Hey,
Sorry about that. Here is the entire portion of the script dealing with the e-mail. I have at least 3 valid e-mails in the table. It only prints one however.
Thanks for the help. Let me know if I can provide any additional information to help you.
thx, Gary
$query="SELECT client_first_name, client_last_name, client_email_address, agent_id FROM clients";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
$participating_subscribers=0;
while ($i < $num) {
$client_agent_id = mysql_result($result,$i,"agent_id");
if ($client_agent_id == $agent_id) {
$client_first_name = mysql_result($result,$i,"client_first_name");
$client_last_name = mysql_result($result,$i,"client_last_name");
$client_email_address_search = mysql_result($result,$i,"client_email_address");
$result_select=mysql_query("SELECT * FROM client_options WHERE client_email_address = '$client_email_address_search'");
if (!$result_select) {
echo 'SELECT query failed. Debugging information follows:<br>';
mysql_error();
exit();
}
/ ---------- Subscriber Opt-Out | Return to Top of Loop | [ CLIENT_OPTIONS ] Data Base ---------- /
if (mysql_num_rows($result_select)) {
while ($row = mysql_fetch_assoc($result_select)) {
$client_email_address = $row["client_email_address"];
$unsubscribe_newsletter = $row["unsubscribe_newsletter"];
}
if ($unsubscribe_newsletter == "active")
++$i;
else {
++$i;
++$participating_subscribers;
/ ------------------------------ Send E-mail to Client ------------------------------ /
$clientsubject = "Message from $agent_first_name $agent_last_name | Newsletter";
//add From: header
$headers = "From: $agent_email_address\r\n";
$headers .= "Reply-To: $agent_email_address \n";
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
//unique boundary
$boundary = uniqid("CLIENT_NEWSLETTER");
//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/alternative" . "; boundary = $boundary\r\n\r\n";
//message to people with clients who don't
//understand MIME
$headers .= "This is a MIME encoded message.\r\n\r\n";
//plain text version of message
$headers .= "--$boundary\r\n" . "Content-Type: text/plain; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("This is the plain text version!"));
//HTML version of message
$headers .= "--$boundary\r\n" . "Content-Type: text/html; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("$newsletter"));
//send e-mail
mail($client_email_address_search, $clientsubject, $clientbody, $headers);
}
}
/ ---------------- Send Subscriber Message Information | [ CLIENT_OPTIONS ] Table -------------- /
else {
++$i;
++$participating_subscribers;
/ ------------------------------ Send E-mail to Client ------------------------------ /
$clientsubject = "Message from $agent_first_name $agent_last_name | Newsletter";
//add From: header
$headers = "From: $agent_email_address\r\n";
$headers .= "Reply-To: $agent_email_address \n";
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
//unique boundary
$boundary = uniqid("CLIENT_NEWSLETTER");
//tell e-mail client this e-mail contains//alternate versions
$headers .= "Content-Type: multipart/alternative" . "; boundary = $boundary\r\n\r\n";
//message to people with clients who don't
//understand MIME
$headers .= "This is a MIME encoded message.\r\n\r\n";
//plain text version of message
$headers .= "--$boundary\r\n" . "Content-Type: text/plain; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("This is the plain text version!"));
//HTML version of message
$headers .= "--$boundary\r\n" . "Content-Type: text/html; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("$newsletter"));
//send e-mail
mail($client_email_address_search, $clientsubject, $clientbody, $headers);
}
}
else
++$i;
}