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 8593197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:56:03+00:00 2026-06-11T23:56:03+00:00

I’m currently working on a php mysql base system that will send email to

  • 0

I’m currently working on a php mysql base system that will send email to multiple recipients from database with checkbox functionally.

How can i send email to those recipient using check all functionality?

Here is my phpMailer code and is working fine

<?php
require("class.phpmailer.php");
include("class.smtp.php");
$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->Host = 'ssl://smtp.gmail.com:465';
$mailer->SMTPAuth = TRUE;
$mailer->Username = 'myemail@gmail.com';
$mailer->Password = 'mypassword';
$mailer->From = 'myemail@gmail.com';
$mailer->FromName = 'Admin';
$mailer->Body = 'TEST EMAIL';
$mailer->Subject = 'This is the subject of the email';
$mailer->AddAddress('myrecipient@yahoo.com');
if(!$mailer->Send())
{
echo "Message was not sent<br/ >";
echo "Mailer Error: " . $mailer->ErrorInfo;
}
else
{
 echo "Message has been sent";
}
?>

another example code i’m currently using in the system to delete a user from database with checkbox functionality:

<?php
/*Check Box Commands*/
$id=$row_notification['user_id'];

if(isset($_POST['Delete'])) {
$checkbox = $_POST['checkbox'];
mysql_select_db($database_connection_ched, $connection_ched);
$id=$row_notification['user_id'];

for($i=0;$i<count($checkbox);$i++)
        {
            $delete = "DELETE FROM tb_user WHERE user_id=$checkbox[$i]";
            mysql_query($delete,$connection_ched);
        }
$result2 = mysql_query($delete);

    if($result2)
    {
    echo "<script language='javascript'>alert ('Successfully Deleted');</script>";
    echo "<meta http-equiv=\"refresh\" content=\"0;URL=notification.php?\">";   }
}
/*End of Checkbox Commands*/
?>
  • 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-11T23:56:04+00:00Added an answer on June 11, 2026 at 11:56 pm

    You can use some of your logic from the delete code you have there, but you can improve that too by just making one call to the db to get your info:

    <?php
    require("class.phpmailer.php");
    include("class.smtp.php");
    $mailer = new PHPMailer();
    $mailer->IsSMTP();
    $mailer->Host = 'ssl://smtp.gmail.com:465';
    $mailer->SMTPAuth = TRUE;
    $mailer->Username = 'myemail@gmail.com';
    $mailer->Password = 'mypassword';
    $mailer->From = 'myemail@gmail.com';
    $mailer->FromName = 'Admin';
    $mailer->Body = 'TEST EMAIL';
    $mailer->Subject = 'This is the subject of the email';
    
    // get checkbox ids posted to us
    $checkbox_ids = $_POST["checkbox"];
    
    // get email addresses from db based on checkboxes posted to us
    $query = "select email from tb_user where user_id in(".join(",",$checkbox_ids).")";
    
    // connect to db and run query
    mysql_select_db($database_connection_ched, $connection_ched);
    $result = mysql_query($query);
    while( $data = mysql_fetch_assoc($result) )
    {
        // make SURE we are not sending this to each and every recipient incrementally.
        // alternately, you can use $mailer->ClearAllRecipients(); <-- this will clear cc and bcc as well
        $mailer->ClearAddresses();
        // send it to THIS user...
        $mailer->AddAddress($data["email"]);
    
    
        print ($mailer->Send()) ? "Message sent to: " : "Message <b>not</b> sent to: ";
        print $data["email"]."<br />\n";
    }
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I need a function that will clean a strings' special characters. I do NOT
I have a view passing on information from a database: def serve_article(request, id): served_article
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.