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

  • Home
  • SEARCH
  • 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 7848341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:10:02+00:00 2026-06-02T18:10:02+00:00

I have this script below that i would like to tweak so it can

  • 0

I have this script below that i would like to tweak so it can do two things:

  1. Send emails to multiple addresses (right now it only works if one email address is being sent an email.
  2. In the “to” field it should not display all others who have received the same notification. So each email should feel individual.

Code:

         //Query to get emails
         //$share_to comes from a drop down selection of users.  
         //it could be 1 person or multiple people.
         //The way its stored in the field is this way user1,user2,user3,user4 or if one person then just user1.  

         $sql = "SELECT email_address from accounts 
         WHERE person_id='$share_to'";
         $result = mysql_query($sql);

         $query = mysql_query($sql) or die 
         ("Error: ".mysql_error());

         if ($result == "")
         {
         echo "";
         }
         echo "";


         $rows = mysql_num_rows($result); 


         if($rows == 0)
         {
         print("");

         }
         elseif($rows > 0)
         {
         while($row = mysql_fetch_array($query))

         {

         $email = htmlspecialchars($row['email_address']);


         print("");
         }

         }


         $headers = "MIME-Version: 1.0\r\n";
         $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
         $headers .= "From: $usermail\r\n";
         $headers .= "BCC: $email\r\n";
         $to = "support@domain.com"; //the mail in the "TO", visible to all. 
         there has to be 1.
         $subject = "$fullname Asked you something";
         $message = "<html><body>";
         $message .= "Hi!, <br><br>$fullname asked you something.<br><br>";
         $message .= "<a href=www.domain.com/login.php>Click here to login.</a><br><br>";
         $message .= "Please reply to this email if you have any questions.<br><br>Thanks,    
         <br><br>Abe<br>";
         $message .= "<img src=www.domain.com/images/logohop.png /><br><br>";

         $message .= "</body></html>";
         mail($to, "Subject: $subject",
         $message, "$headers" );
         echo "";
  • 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-02T18:10:04+00:00Added an answer on June 2, 2026 at 6:10 pm
    //Query to get emails
             //$share_to comes from a drop down selection 
             of users.  it could be 1 person or multiple 
             people.The way its stored in the field is 
             this way user1,user2,user3,user4 
             or if one person then just user1.  
    
             $sql = "SELECT email_address from accounts 
             WHERE person_id='$share_to'";
             $result = mysql_query($sql);
    
             $query = mysql_query($sql) or die 
             ("Error: ".mysql_error());
    
             if ($result == "")
             {
             echo "";
             }
             echo "";
    
    
             $rows = mysql_num_rows($result); 
    
    
             if($rows == 0)
             {
             print("");
    
             }
             elseif($rows > 0)
             {
             $email='';
             while($row = mysql_fetch_array($query))
    
             {
    
             $email. = htmlspecialchars($row['email_address']).',';
    
    
             print("");
             }
    
             }
    
    
             $headers = "MIME-Version: 1.0\r\n";
             $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
             $headers .= "From: $usermail\r\n";
             $headers .= "BCC: ".rtrim($email,",")."\r\n";
             $to = "support@domain.com"; //the mail in the "TO", visible to all. 
             there has to be 1.
             $subject = "$fullname Asked you something";
             $message = "<html><body>";
             $message .= "Hi!, <br><br>$fullname asked you something.<br><br>";
             $message .= "<a href=www.domain.com/login.php>Click here to login.</a><br><br>";
             $message .= "Please reply to this email if you have any questions.<br><br>Thanks,    
             <br><br>Abe<br>";
             $message .= "<img src=www.domain.com/images/logohop.png /><br><br>";
    
             $message .= "</body></html>";
             mail($to, "Subject: $subject",
             $message, "$headers" );
             echo "";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable to the button below that I would like to replace:
I have a Korn shell script that I would like to change a variable
I have this script that collects data from users and I want to check
I have a Moose class that i would like to store using Apache::Session::File. However,
I am looking for some help. I have found this script that sort of
I have a rally.sdk.ui.basic.Dropdown menu in a Rally App that I would like to
I have a script (pasted below) that pulls in the meta descriptions from a
I would like to call an R script from Java. I have done google
I'm creating a login script. In this script, I would like to limit the
In my example code below, you can see that I have been trying to

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.