Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9233677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:36:43+00:00 2026-06-18T06:36:43+00:00

I have not faced any problems sending email to a particular user, but the

  • 0

I have not faced any problems sending email to a particular user, but the problem occurred when I tried sending the similar message to all emails found in the database (MYSQL).

If I have 4 users found in the database, it still sends to all the 4 users, but the similar content of the email is repeated 4 times. If 250 users found, then 250 repeated contents.

The code snippet of the code is as such, been meddling with it, tested it for many times, and I ran out of ideas. Thanks for looking, any help is much appreciated…

} elseif ($temptarget == 'Parents'){

$g1chk = mysql_query("SELECT * FROM wmsidb WHERE s_stat='ACTIVE'");
$g1found = mysql_num_rows($g1chk);

While ($rowg1 = mysql_fetch_array($g1chk)){

   $tempemail1 = $rowg1['g1_email'];
   $tempemail2 = $rowg1['g2_email'];

   $comments = (stripslashes($_POST['message']));

   $to = "Parent <$tempemail1>, Parent / Guardian <$tempemail2>" . "\r\n";
   $subject = "[$anndate] Announcement ::: $temptitle";

   // Main Headers
   $headers = "MIME-Version: 1.0" . "\r\n";
   $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

   // Additional Headers
   $headers .= "From: Contact Us <mailer@mailer.com>" . "\r\n";

   $message .= "
   <table align='center' border='0' width='100%' cellpadding='6'>
   <tr><td width='100%' align='left' bgcolor='#33327e'><font face='Arial' size='4' color='#ffffff'><b>" . strtoupper($temptitle) . "</b></font></td></tr></table>

   <table align='center' border='0' width='100%' cellpadding='3'>
   <tr><td width='10%' align='right'><font face='Arial' color='#636363'> date </font></td><td width='90%' align='left'><font face='Arial'>" . $tempdd . " " . strtoupper($tempmm2) . " " . $tempyear . "</font></td></tr>
   <tr><td width='10%' align='right'><font face='Arial' color='#636363'> posted by </font></td><td width='90%' align='left'><font face='Arial'>" . $temppost . "</font></td></tr>
   <tr><td width='10%' align='right' valign='top'><font face='Arial' color='#636363'> message </font></td><td width='90%' align='left'><font face='Arial'>embedded below...</font></td></tr>
   </table>

   <br/>

   <table align='center' style='border:1px solid grey' width='95%' cellpadding='18'>
   <tr><td width='100%' align='left'><font face='Arial'>" . $comments . "</font></td></tr>
   </table>

   <br/>";


   if ($tempfeedback == 'Yes'){

   $message .= "
   <table align='center' border='0' width='100%' cellpadding='3'>
   <tr><td width='10%' align='right'><font face='Arial' color='#636363'> feedback </font></td><td width='90%' align='left'><font face='Arial'>We need you to provide us a response to announcement above.</font></td></tr>
   <tr><td width='10%' align='right'><font face='Arial' color='#636363'></font></td><td width='90%' align='left'><font face='Arial'>Please complete the 'Feedback Form' found in the link below. Thank you!</font></td></tr>
   <tr><td width='10%' align='right'><font face='Arial' color='#636363'> link </font></td><td width='90%' align='left'><font face='Arial'><b><a href='' target='_blank'>link</a></b></font></td></tr>
   </table>";

   } else {

   $message .= "
   <table align='center' border='0' width='100%' cellpadding='3'>
   <tr><td width='10%' align='right'><font face='Arial' color='#636363'> feedback </font></td><td width='90%' align='left'><font face='Arial'>No feedback required.</font></td></tr>
   </table>";

   }


   $message .= "
   <p><font face='Arial'><br/>

   <br/><br/>

   Footer with contact information

   </font></p>";


   mail ($to,$subject,$message,$headers);

}

   echo "<tr><td width='80%' align='right'><font face='Arial' color='#636363'>" . $g1found . " emails sent to parents / guardians </font></td><td width='20%' align='middle'><font face='Arial'>OK</font></td></tr>";
   echo "<tr><td width='80%' align='right'><font face='Arial' color='#252525'>module terminated</font></td><td width='20%' align='middle'><font face='Arial'></font></td></tr>";

   echo "</table>";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:36:45+00:00Added an answer on June 18, 2026 at 6:36 am

    Sure it does.

    The variable message is being populated each time the loop runs, so at the beginning of each loop do: $message= "";

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that I have not faced before: It seems that the
have not tested on windows. but in ubuntu when u disconnect from the network,
I have not changed any of the configuration options for sessions in my php.ini.
We have not purchased an SSL certificate so the user of our website has
I have not been able to find any definitive answers to this question: Can
I have not done any animation stuff with iphone development so far. Can anybody
I have a problem in myeclipse debug mode where execution is not stopping on
I'm faced with a couple of problems in VB.net: I have a series of
i have faced some problem while navigating from one class to another with the
we have faced a problem with our production system yesterday which I am unable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.